Keep a file in memory an any cost

JB jb.1234abcd at gmail.com
Wed May 11 20:57:03 UTC 2011


Alain Spineux <aspineux <at> gmail.com> writes:

> 
> Joe: The index is modified very often and need to be flushed at
> regular interval, I don't want to handle read and write.
> JB: I already use mmap.
> JD: I already tried posix_fadvise with POSIX_FADV_WILLNEED, but this
> is not rock solid, if not used for a long time, data are not in the
> cache anymore.
> Bryn: mlock is what I was looking for. I'll make a try now.
> ...

I do not know if you are aware of:
$ man mmap
...
       MAP_LOCKED (since Linux 2.5.37)
              Lock the pages of the mapped region into memory in the manner of
              mlock(2).  This flag is ignored in older kernels.
...

JB




More information about the users mailing list