On Tue, Jul 29, 2008 at 8:04 AM, Alexander Sychev <santucco@gmail.com> wrote:
On Tue, 29 Jul 2008 12:52:14 +0400, Enrico Weigelt <weigelt@metux.de> wrote:

Hi!


an full mmap() is a really nice thing. It can make a lot things
easier if you just map the whole file into the process' memory and
let the kernel handle the actual IO.

Yes, it is comfortable. But just think a bit - what will you do in the mmap implementation when you had mapped a remote file (in Plan9 you can't be sure some file is local or it is really just a file), and the connection has just been broken? Surprise!


For example, in Windows you will have an "access violation". It is very funny to rewrite a code for using the good old file i/o instead of mmap.
In Linux you can't map a non-regular file.

Yes, you can read entire the file into the memory, but a size of the file can be very big and you will destroy the main advantage of mmap - the reading of only needed pieces of the file, not entire.

And if you read it in in pieces, how can you be sure the file isn't changing on the system it's hosted on while you're looking at it?  
 

I beleive, mmap is not for distributed systems.

--
Best regards,
       santucco