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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to