Xref: utzoo comp.unix.wizards:11823 comp.lang.c:13371 Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!ncsuvx!gatech!udel!rochester!bbn!spdcc!ima!minya!jc From: jc@minya.UUCP (John Chambers) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: Record-access libraries (with query on NFS) Message-ID: <107@minya.UUCP> Date: 17 Oct 88 20:21:36 GMT References: <287@cvbnet2.UUCP> Followup-To: comp.unix.wizards Organization: (none) Lines: 28 > 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). There's also a warning that the raw disks should be only accessed in multiples of a sector. In fact, most programs use multiples of BUFSIZ, which is invariably a multiple of a sector. The exact wording in one of the manuals describes the "'raw' interface which provides for direct transmission between the disk and the user's read or write buffer. A single read or write call results in exactly one I/O operation and therefore raw I/O is considerably more efficient when many words are transmitted." Note the specific claim that the transfer is direct between the disk and the buffer in user space, without going through a kernel buffer. Of course, this is all at the whim of the driver, so some vendors could have screwed it up... -- John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393) [Any errors in the above are due to failures in the logic of the keyboard, not in the fingers that did the typing.]