Re: fadvise syscall?

Mark Mielke
2002-03-17T18:35:45Z

On Sun, Mar 17, 2002 at 05:14:20PM +0000, Anton Altaparmakov wrote:
> At 15:13 17/03/02, Ken Hirsch wrote:
> >There is a posix_fadvise() syscall in the POSIX Advanced Realtime
> >specification
> >http://www.opengroup.org/onlinepubs/007904975/functions/posix_fadvise.html
> Posix or not I still don't see why one would want that. You know what you
> are going to be using a file for at open time and you are not going to be
> changing your mind later. If you can show me a single _real_world_ example
> where one would genuinely want to change from one access pattern to another
> without closing/reopening a particular file I would agree that fadvise is a
> good idea but otherwise I think open(2) is the superior approach.

Also, at least in theory, open() can begin loading pages the moment it
completes (if the system is sufficiently idle). Calling madvise() "at
some later point" would allow a window during which the kernel could
already be loading the wrong pages, before it is *then* told "oh btw, I
really want *these* pages." As an example (assuming open() doesn't do this
already) I would be pleasantly surprised if open(O_RDONLY | O_SEQUENTIAL)
began loading at least the first page in the file the moment open() was
successful. Then, when we get control back to actually do a read() (we
may have been interrupted during open()) the page is already there.

mark

--
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...