Re: Task dispatching
Re: Task dispatching
- Subject: Re: Task dispatching
- From: Steve Sisak <email@hidden>
- Date: Tue, 13 Sep 2011 17:28:54 -0400
At 2:39 PM -0600 9/13/11, Scott Ribe wrote:
\Note that your disk is not really providing 1.25GB/sec reads. What
was probably happening is that the file contents were in system
cache because of your prior reads. (Assuming that with the mmap code
you were actually reading all the data...)
Actually, I believe that mmap just maps the the file into memory
using the VM system -- it's initially paged out and read in as each
page is touched.
This means you take the equivalent of a VM page miss the first time
you touch a page but:
1) You also never read in pages that aren't touched (if your array is sparse)
2) Multiple process will share the same copy of the file in RAM
3) Page outs are "free" because the memory is backed by the file
4) Pages are read efficiently and don't pollute the FS cache
So, this is a very efficient way to handle a large data set.
BTW, if I were writing new code, I'd probably use NSOperation or
dispatch queues and a single process.
Check out Quinn's QHTTPOperation sample code.
HTH,
-Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden