Article View: comp.lang.misc
Article #1542Re: buffering, was Query
From: John R. Levine
Date: Tue, 21 Aug 1990 22:33
Date: Tue, 21 Aug 1990 22:33
21 lines
1671 bytes
1671 bytes
In article <60345@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
>From article <126800008@.Prime.COM>, by EAF@.Prime.COM:
>> If your language I/O library is intelligent and you are reading sequential
>> data, the language library will call on the OS to read the next disk
>> block into memory, often before it is required.
>
>Not on UNIX it won't. There is no system call for the library to use ...
Unix systems have, for over ten years, had the following useful little hack:
It keeps track of the last block you read from each open file. If you are
reading block N, and the last block you read was N-1, then the system out of
sheer optimism tells the disk to pre-read block N+1. This brings the magic
of double buffering to any program that reads a file sequentially, whether it
uses an I/O library or just does read() system calls. Buffered writing
happens, too, since write system calls don't wait for the physical I/O to
complete.
--
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|spdcc|world}!esegue!johnl
Marlon Brando and Doris Day were born on the same day.
Technical Details
Message-ID:
<1990Aug21.223350.7595@esegue.segue.boston.ma.us>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!ncar!husc6!spdcc!esegue!johnlReferences:
<126800008@.Prime.COM> <60345@lanl.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!ncar!husc6!spdcc!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.lang.misc Subject: Re: buffering, was Query Message-ID: <1990Aug21.223350.7595@esegue.segue.boston.ma.us> Date: 21 Aug 90 22:33:50 GMT References: <126800008@.Prime.COM> <60345@lanl.gov> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Organization: Segue Software, Cambridge MA Lines: 21