buffer/vm cache, turn off for a specific file ?
From: Andrew Torda (andrew.torda_at_anu.edu.au)
Date: 03/31/05
- Next message: Geoff Clare: "Re: Problem to read on a serial port"
- Previous message: Bjorn Reese: "Re: pointers to stack and -03"
- Next in thread: Roger Leigh: "Re: buffer/vm cache, turn off for a specific file ?"
- Reply: Roger Leigh: "Re: buffer/vm cache, turn off for a specific file ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2005 14:57:17 +0200
My program reads 10000 files in turn (fopen(), fread(), ... fclose())
Regardless of how low its priority (nice'ness), it makes a
machine very very unresponsive if it is running in the
background.
What seems to happen is that the OS, linux, caches each
file. After a while, everything else that was cached gets wiped
out. When a user hits a keystroke, the pages from the user's
application have been paged out and have to be found again.
There is no point in caching the 10000 files read by my
program. They are only read once.
Is there any way to ask the system to *not* to cache a file after
fopen()ing it ?
The 10000 files are NFS mounted, but I imagine the problem would
still happen with a local file system.
Pretty much everything in the code is ANSI C, but this is so
desperate, I would gladly put in linux specific, lower level code
if it helped. I do not want to replace the fopen(), but I am
happy to use fileno() to get the file descriptor and play with
it. I certainly have not found anything useful amongst the calls
to fcntl().
This code has to run in the background on machines maintained by
others, so it is not really practical to play with kernel options
which manipulate the split of vm / file buffer cache.
I would be grateful for any advice.
Andrew
- Next message: Geoff Clare: "Re: Problem to read on a serial port"
- Previous message: Bjorn Reese: "Re: pointers to stack and -03"
- Next in thread: Roger Leigh: "Re: buffer/vm cache, turn off for a specific file ?"
- Reply: Roger Leigh: "Re: buffer/vm cache, turn off for a specific file ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|