Re: Page cache and swapping

Bernd Schmidt (crux@Pool.Informatik.RWTH-Aachen.DE)
Mon, 30 Jun 1997 10:23:12 +0200 (MET DST)


> > 1. to the one saying qsort'ing mmaped file would be agood idea:
> >
> > if you qsort a file that does not fit in memory, your program
> > is nearly broken - qsort has almost no locality, so you
> > get what you deserve... slow performance. qsort is one
> > of the worst sorting algorithms for this case.
>
> But it does fit in memory, at least if you are talking about the program
> I posted.

I have not tried your program yet, but looking at it I'm not sure it fits
completely into memory. How much RAM does your machine have, and how big
a file are you using?

> I _think_ the problem is update (or whatever update calls) locks
> all the pages when it tries to synchronzie the disk and memory images. If
> this is what it going on it would be nice if the kernel would not try to
> flush diry file pages if they had been accessed in the last second or so.

Dirty file mmapped pages are only ever written back if the system calls
try_to_swap_out, which happens only in low-memory situations. If your map
really did fit into physical RAM, the data would never get written back
until you unmap the file or exit the program.
It could hit one of the filemap bugs when it unmaps the area and starts
writing out the dirty pages, though.

Bernd