Subject: Re: direct I/O
To: Chuck Silvers <chuq@chuq.com>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-kern
Date: 03/03/2005 23:09:30
Chuck Silvers <chuq@chuq.com> writes:
> POSIX requires that for regular files, read() and write() be atomic with
> respect to each other (and write()s with respect to other write()s),
> so we do need to keep enough locking to provide that.  however, there no
> requirement that non-overlapping write()s be serialized, so tracking
> the ranges are being read or written allows greater concurrency than
> the current scheme of just tracking read vs. write.

Thanks for pointing this out.  I was not aware of a requirement in this
area.  However, after your assertion, and yamt's comment, I looked it
up in the online opengroup spec 6.  I found this in the rationale to the
read() call found at:
http://www.opengroup.org/onlinepubs/009695399/functions/read.html

  I/O is intended to be atomic to ordinary files and pipes and
  FIFOs. Atomic means that all the bytes from a single operation that
  started out together end up together, without interleaving from
  other I/O operations. It is a known attribute of terminals that this
  is not honored, and terminals are explicitly (and implicitly
  permanently) excepted, making the behavior unspecified. The behavior
  for other device types is also left unspecified, but the wording is
  intended to imply that future standards might choose to specify
  atomicity (or not)

Darrin