Subject: Re: mmap (was Re: bin/10625: /usr/bin/cmp)
To: None <kre@munnari.OZ.AU>
From: Atsushi Onoe <>
List: tech-userlevel
Date: 07/30/2000 11:34:14
> mmap() is a random access interface, and while it would be
> possible to trace the page faults in the mmap area (while excluding others)
> and infer a sequential access pattern, that's a lot harder than just
> watching the file offset sequentially increasing...

Isn't it the reason why madvise(2) was introduced?

Though I don't know neither Mach VM nor UVM yet, the SVR4 VM has very
simple mechanism for read(), create the corresponding map within kmem,
then bcopy from the mapped area to the user buffer.  The page faults
occurs if necessary, and each file system detects whether it is
sequential or not.

Anyway, bcopying from kmem to user address space cannot be omitted
unless the user buffer is aligned and at least 1 page long.
For aligned page buffer case, it seems possible that read() remap
the buffer to point corresponding kernel buffer with COW.

Atsushi Onoe