Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!bnlux0!adelphi!promark!mark From: mark@promark.UUCP (Mark J. DeFilippis) Newsgroups: comp.unix.questions Subject: Re: Are terminal writes atomic? Summary: Writes are atomic under UNIX Message-ID: <186@promark.UUCP> Date: 3 Oct 89 01:34:26 GMT References: <-286379999@hpcupt1.HP.COM> <1118@cs.yale.edu> Organization: Promark Data Concepts, Garden City, NY Lines: 23 In article <1118@cs.yale.edu>, spolsky-joel@CS.YALE.EDU (Joel Spolsky) writes: > I think this is safe. A while ago I wrote a little program that runs > on a Unix host, and puts the time, date, and warns you if you get mail > in the status line of TVI950's or VT100's. > write() commands were preserved atomically. > How about we take this further. The answer to this question is an undocumented feature of write() under Unix. Several Authors note that write() is atomic under Unix and that it is undocumented. One is Marc J. Rochkind in his book _Advanced Unix Programming_, Prentice-Hall. Writes are Atomic, no matter what you are writing to, even terminals. However, if you have two processes writing to the same device simultaneously, you cannot guarantee which one will preceed the other, (assuming no formal communication between the two processes course). -- Adelphi University, Garden City, NY 11530 (516) 663-1170 Department of Mathematics and Computer Science markd@adelphi.UUCP or mark@promark.UUCP UUCP: ...philabs!sbcs!bnlux0!adelphi!markd