
John Meacham wrote: I'm jumping into this discussion half way through, so my apologies if I mention something that's already been talked about!
of course, [mmap] can only be done on a limited type of file on some architectures, so it should be an optimization under the hood rather than an exposed interface.
In particular, you have to be careful not to run out of address space on 32-bit architectures. If you try to do file access by mapping the whole file into virtual memory, you won't be able to handle files larger than 2G or so. You also have to be careful not to map a number of file chunks, which in total exceed the address space available. Because of these constraints, building a general purpose I/O system around mmap would be quite difficult, wouldn't it? You would have to deal with situations where, for example, a chunk of a file is mapped and the user writes off the end of the chunk. Pete