Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way of forcing or prioritizing a directory, files or files being written/read by a certain process into the kernel file cache?

edit: system is linux.

edit: I have 1 process which writes a file and about 7-10 processes which read the file thats written by the one process. I'd like to minimize the overall disk i/o involved.

share|improve this question

closed as not a real question by womble, Scott Pack, EEAA, HopelessN00b, Ladadadada Aug 27 '12 at 13:20

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Please describe the problem you're trying to solve, rather than asking us how to implement the poorly-conceived solution you've come up with. – womble Aug 21 '11 at 22:51
I added a few more details – incognito2 Aug 22 '11 at 2:08
up vote 2 down vote accepted

The kernel will take the optimal caching action automatically, assuming that you have sufficient memory to carry all of the cache. Attempting to preseed the cache isn't going to be helpful in the general case; it is only of use when you need to have quick user-visible processing time, at the expense of more time involved earlier in the process, which doesn't appear to be the case here.

If you need the best possible I/O rate, and you don't care if you lose the file data in the event of a catastrophe, you can do the file I/O on a ramdisk (tmpfs); this will completely eradicate the disk I/O, but the contents of the filesystem will be lost on reboot.

share|improve this answer

Reading the files should "force" them into the cache. I assume you want to preload some files into cache?

I am tempted to say that "dd if=file of=/dev/null bs=4M" should force the file into the cache. Are you talking about Linux?

share|improve this answer
yes the system is linux – incognito2 Aug 22 '11 at 1:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.