4 ms·
Actually, in my experience, read-ahead into cache is what the OS does NOT handle for you. To get file-level read ahead in *nix you need to use normal IO syscal
by Andys 15y ago
Actually, in my experience, read-ahead into cache is what the OS does NOT handle for you. To get file-level read ahead in *nix you need to use normal IO syscalls. mmap is only suitable for completely random IO.
- ghotli 15y agoIn instances where you may have many processes reading the same files in some sort of access pattern and you know they need to be in disk cache you can use fadvise[1]. It'll let you tell the kernel that I am going to need that file, why don't you go ahead and get it in the disk cache. For many applications this is not the right way to go, but for completely predictable access patterns on a machine that is devoted to it, it can save the day. [1] http://linux.die.net/man/2/fadvise http://linux.die.net/man/2/fadvise
- rbranson 15y agoThere is an madvise() syscall that roughly translates into an fadvise() for memory-mapped regions as well.