Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!kaon!nucsrl!naim
From: naim@eecs.nwu.edu (Naim Abdullah)
Newsgroups: comp.unix.wizards
Subject: Is write(2) "atomic" ?
Message-ID: <11410005@eecs.nwu.edu>
Date: 12 Jul 88 10:12:23 GMT
Organization: Northwestern U, Evanston IL, USA
Lines: 17

Do UNIX semantics guarantee that write(2) calls will be "atomic" ?

Suppose, process A executes write(fd, "123", 3) and process B
executes write(fd, "456", 3) "concurrently". The file descriptor fd
is shared between them (the file was creat(2)'ed for writing by the
common parent of A and B). Does UNIX guarantee that the contents of
the descriptor will be "123456" or "456123" (depending on which of
A and B won the race) but never "124536" ? Does it make a difference
whether the descriptor is a pipe or a terminal or a disk file or a
tape drive or something else ?

		      Naim Abdullah
		      Dept. of EECS,
		      Northwestern University

		      Internet: naim@eecs.nwu.edu
		      Uucp: {oddjob, chinet, gargoyle}!nucsrl!naim