Is write(2) "atomic" ?

Boyd Roberts boyd at basser.oz
Thu Jul 14 17:09:22 AEST 1988


Ok guys, enough is enough.  Regular file writes are atomic,
courtesy of plock().  Pipe writes are atomic, courtesy of
plock(), provided the size of the write is less than the
MAXIMUM size (not the available size) of the data that
can be held in the pipe.

Directory _writes_ (yes, it's a side affect of namei())
are atomic, courtesy of plock().

Character special writes are ``atomic'' on cblock boundaries
for tty style devices.  That is, not truly atomic.

Sockets, ether-packets, etc _should_ be atomic in the expected way.
Read your protocol _spec_ right now!!

Stream writes (from memory... my memory, not RAM) should
be atomic due to allocb() allocating a large enough block
to contain the data.   A bit like pipes, really.

Block special writes are atomic on block boundaries.  You
are _supposed_ to do ``block'' transfers.

Yes, there are races, but there are atomic writes.

A word of warning, do not reply or post anything containing
any of the following ``words'':

	   NFS
	   RFS
	   POSIX
	   X/OPEN

We are discussing UNIX file system semantics.


Boyd Roberts			boyd at basser.cs.su.oz
				boyd at necisa.necisa.oz

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.wizards mailing list