Is write(2) "atomic" ?

Chris Torek chris at mimsy.UUCP
Wed Jul 13 07:18:45 AEST 1988


In article <23801 at bu-cs.BU.EDU> bzs at bu-cs.BU.EDU (Barry Shein) writes:
>I think the result is indeterminate (undefined), a few experiments
>here on various systems came up with some even stranger results ....

It is certainly not well-defined.  4BSD makes writes to regular files
and block special files atomic by locking the inode across the write()
call.  Character devices like terminals tend to be written atomically
only when the number of characters written fits in a cblock.  Appending
by lseek/write (rather than FAPPEND) has a race between the lseek and
the write, and so forth.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list