Is there a way to disable file cache for a particular process ?
I have two process running A and B.
I want file opened by A to remain in cache.
and
I don’t want to enable file cache for B so It doesn’t replace the file cached by process in the memory.
Is there a way to disable file cache for a particular process?
None that I know of… the only option are global/device-specific:
Another point:
Even IF you could do what you ask for there is no guarantee that any other processes (C, D, E etc.) behaves in a way that “the file cached by process A in the memory” gets replaced…
UPDATE – after comments from OP ragarding performance:
Linux offers (as most modern OS) something called “memory-mapped file” – basically this is a way to access the file’s contents in-memory… the OS assigns the file (depending on the given params) part of the address space and loads the content of the file into that address space (again: exact behaviour depends on the given params).
You would do this in Process A to achieve what you want…
Checkout the
mmapAPI calls for details.