Re: Buffer cache hints

Richard Gooch (rgooch@atnf.csiro.au)
Sat, 7 Sep 1996 12:43:53 +1000


Jonathan Wexler writes:
>
> On Fri, 6 Sep 1996, Richard Gooch wrote:
>
> > Hi, all. I have a process which reads a large file (nearly half the
> > size of RAM) and swap-copies it into a malloced array of the same
> > size. This results in a lot of disc head movement as pages are read
>
> Why not use mmap()? (if the data is in the same form as you want it in
> memory)

I do use mmap() sometimes, but I still have to swap the bytes (I
just use mmap() and bcopy() instead of read() to read from the
file). It would be so nice if the data was in host-natural form, but
alas, no.
I have one file which is 30 MBytes, and my disc rattles like crazy for
a few minutes before all the data has been read and swap-copied into
VM. If it wasn't for the unneccesary paging, this would take 15 to 20
seconds with my machine with 64 MBytes of RAM.

Regards,

Richard....