UNIX semantics do permit full support for asynchronous I/O

Chris Torek chris at mimsy.umd.edu
Sun Sep 2 08:10:56 AEST 1990


>In article <1990Aug30.222226.20866 at cbnewsm.att.com>
lfd at cbnewsm.att.com (leland.f.derbenwick) writes:
>>In essentially any serious database application, a completed
>>write() to a raw disk is treated as a guarantee that the data
>>block has been _physically written to the device_. ...

In article <1990Sep1.185221.8718 at eng.umd.edu> stripes at eng.umd.edu
(Joshua Osborne) writes:
>Unix guarantees no such thing.  If you want it you need to use
>fsync(filno), or open the file in sync mode.  Currently Unix copys
>data to write into it's disk buffers, ....

Look again: he said `raw disk'.  Raw I/O calls physio; physio calls
vslock (in 4BSD anyway); vslock pages in and locks in core all the
memory needed for the transfer; physio calls physstrat or the device
strategy routine (depending on the partiuclar variant of 4BSD);
physstrat (if it exists) calls the device strategy routine; the device
routine queues the transfer and, if necessary, starts the device, then
returns; and then physio/physstrat *WAITS*.  Finally, physio calls
vsunlock (which may also mark the pages as modified) and returns.

It would be useful to be able to start raw transfers without waiting.
I once (actually, twice) wrote a driver that did this.  Sort of a hack,
but it worked.  It required changes to vsunlock() (to allow it to be
called at interrupt time) and exit() (to avoid throwing away the
process VM until the device close routines finished up).  It would be
better to do this more directly, though.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list