News for hackers. Stuff that matters.
Re:ARM64 and You by mikeash on Friday September 27, 2013 @08:18PM (#6460346)
Apple's NSData API even has a flag just for this, NSDataReadingMappedIfSafe. Basically, it uses memory mapping if the file is on the root filesystem, and otherwise just reads it all in conventionally. This is because if you end up memory mapping a file on a USB stick and the user yanks it, you'll segfault, and nobody likes a crashing app.

On the subject of memory mapping and magnetic disks, one amusing bit of history is that GNU's Hurd kernel originally implemented filesystems by memory mapping the entire hard drive and working from there. This worked fine at first, but started to cause major trouble when HDs grew beyond 4GB and Hurd was still running on 32-bit CPUs. I believe they ended up redoing it all without memory mapping so they could grow beyond that limit.

There are no comments on this comment yet.