File hinting, and a new file flag?

Lou Grinzo (lgrinzo@stny.lrun.com)
Wed, 14 Jul 1999 08:07:46 -0400


The recent discussion about hinting and speculative execution
brought to mind something I've long wondered about: Why is
there no way to specify on a file open that you will be reading
an entire file sequentially? If the OS knew about the caller's
intentions at open time, it could check the available memory and
the file's size, and if the ratio were high enough, it could read
the whole file into a buffer, or even run a background thread to
do read aheads.

This would only apply to read-only access of existing files, obviously,
and lacking enough memory, the OS would just ignore the flag an
do a normal open. Given how often software processes a file in
exactly this way, it seems like an opportunity to let the programmer
help the OS perform an optimization.

I've tried to find an example of this being tried in an OS, but come up
empty. It's such a simple idea that I have to believe it's been looked at
before.

Lou

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/