Record-access libraries (with query on NFS)

Dominic Dunlop domo at riddle.UUCP
Fri Oct 21 23:36:56 AEST 1988


In article <107 at minya.UUCP> jc at minya.UUCP (John Chambers) writes:
>> If you access the raw disk device do you disable that read-ahead and
>> write-behind aspect of the UNIX filesystem abstraction?
>
>Oh, wow!  A question with a simple answer: Yes.  According to several
>manuals, the main difference between /dev/dsk* and /dev/rdsk* is that
>there is no buffering for the latter.  Reads always delay for physical
>I/O, and writes always go immediately to disk (though with DMA, the
>write may not be complete when write() returns). 

Worse, the disk controller hardware may be ``intelligent'', buffering write
data in its private memory for an indeterminate time before actually
writing it onto the physical disk medium.

>Of course, this is all at the whim of the driver, so some vendors 
>could have screwed it up...

Quite.  A clued-up, socially-responsible, driver writer might take the
trouble to disable buffering in an intelligent controller for raw writes,
or to wait for a ``local buffer empty'' condition before returning.  My
bet is that this level of attention to detail is rare.

UNIX System V, release 3 and later (but not the POSIX standard, IEEE
1003.1, or, as an example of a BSD-derived system, SunOS) has a
synchronous write facility (enabled with the O_SYNC flag to open() or
fcntl()), under which, to quote from the SVID, issue 2, volume 3, ``each
write should wait for both the file data and file status [the inode, that
is] to be physically updated.''  (You can bet that the 1003 working groups
will tighten up that wording if they decide to put O_SYNC in a future
standard.)  I see no reason that synchronous writes should be immune to the
invidious effect of ``intelligence'' either.

This is where I get to admit my ignorance: maybe five years ago,
intelligent controllers which defeated the ``write straight to disk''
characteristic of raw devices were dismayingly commonplace.  Since that
time, I'm glad to say that I've become less involved with such nitty-gritty
characteristics of particular types of system.  Would any current hardware
jockey (please take the term as a compliment) care to comment on whether
today's disk controllers exhibit similar behaviour?

One thing that makes me think that the problem may still be around is
this: there has been recent discussion elsewhere about the ability to do
single byte reads and writes to raw disks on certain computers.  Hmmm.
Sounds as though the controllers have their own buffers, doesn't it?  Has
the data actually hit the disk by the time a raw write returns?  Would
anybody like to comment specifically on this?
-- 
Dominic Dunlop
domo at sphinx.co.uk  domo at riddle.uucp



More information about the Comp.unix.wizards mailing list