On Sun, Nov 1, 2015 at 10:25 PM, Simon Slavin <slavins at bigfraud.org> wrote: > > On 2 Nov 2015, at 3:48am, sanhua.zh <sanhua.zh at foxmail.com> wrote: > >> I thought it might be storage contention, too. >> BUT, as the documentation of SQLite said, in ?DELETE? mode, SELECTing do >> read for disk only. > > Even reading needs the attention of the disk. You tell the disk what you > want to read and it has to find that piece of disk, read it, and give the > result to you. It cannot answer four requests at once so while it's > answering one, the other threads have to wait. > > (Yes disk is cached. But that just moves the problem from the hard disk to > the piece of software which handles the cache. It cannot answer four > questions at once.)
Serializing in user space is going to prevent pipelining, so it's definitely not the greatest idea. Command queuing is a great reason to have parallel I/Os and can make a big difference depending on your storage type. SSDs can read multiple NAND chips at once, HDDs can start moving the head to the next location as soon as possible, etc. Though, I'm not sure how applicable this is to iOS development. -- Cory Nelson http://int64.org