[comp.unix.questions] concurrent read/write question

les@chinet.chi.il.us (Leslie Mikesell) (11/07/90)

Is it safe for one process to from a file while another one is writing
(i.e. can small write()s be considered atomic)?  The only scenario where
I would anticipate a problem is where the write() spans a block (the
writes are small, but not necessarily alligned with disk blocks).  If
the second buffer block needed for the write() to complete needs to
be read from disk, does the entire operation block or might the first
block affected be written to the disk buffer and another process allowed
to run while the disk operation completes? 
This is under SysVr3.2.  If concurrent operations are not safe, would
alligning the data so writes never span disk blocks help?  If I need
a locking mechanism, what would have the least impact on the writing
process?

Les Mikesell
  les@chinet.chi.il.us