Le 19 nov. 2010 à 17:48, Michel Sébastien a écrit :

> Is mmap still efficient ? map a gigabit file should cost a lot of I/O and a 
> relatively long reponse time to just access the records of the most recent 
> emails.


mmap does nothing besides mapping the file as virtual memory to your process. 
Read requests on memory addresses within the mmap range yield in page-ins of 
"pages" of the mmap'd file - it behaves like swap space. if you write in this 
mmap'd virtual memory range then you'll trigger a pageout when the system's vm 
system thinks it's time to write the page out (or you unmap the file). This is 
a very efficient way to access a file.

So mapping a Gigabyte file does not need much i/o - and 10 read accesses result 
in a maximum of 10 pages read.

The file (or the offset given with mmap() ) must fit in the process vm, so 
mmap'd files can be much bigger in size on 64 bit platforms.

Pascal

----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/

Reply via email to