man 2 write - clarification

John Moser john.r.moser at gmail.com
Thu Mar 18 19:27:57 UTC 2010


On Wed, Mar 10, 2010 at 6:48 AM, Daniel Baluta <daniel.baluta at gmail.com> wrote:
> Hello,
>
> The following phrase taken from man 2 write manual page is confusing:
> POSIX  requires that a read(2) which can be proved to occur after a
> write() has returned returns the new data.
>

This parses properly.  "a read(2) which can be proved to occur after a
write() has returned" is a noun clause.

> I think you should you some comas to make a clear statement.
> POSIX  requires that a read(2), which can be proved to occur after a
> write() has returned, returns the new data.

"a read(2)" is a noun clause.

"which can be proved to occur after a write() has returned" is
adverbial when separated by commas.

Thus, in your suggested form, we would delete the stuff between commas
because it's auxiliary; but this is incorrect, because it's a
constraint.

Perhaps the following:

"POSIX requires a read(2) provably occuring after the return of a
write() to return the new data."

This is why more complex things are written in a very dry and
structured manner...

  Given the assumptions:

  1.  That a write() has been performed;
  2.  That the write() performed in [1] has returned;
  3.  That a read() is performed;
  4.  That the read() performed in [3] had been performed at some time
later than [2];
  5.  That [4] is provable in the context of the program executing the read()

  The read() performed in [3] must return the new data acquired by the
write() performed in [1].

Notice my wording in (5).  If a program has not verified that a
write() performed in another thread has returned correctly (by thread
synchronization), then it may execute the read() before or after that
write() has actually been performed (i.e. the program doesn't know any
better).  The OS of course would have an easier time making better
assumptions, since it only has to check the real state of read/write
requests internally.  But whatever.

This "communications" thing is complex.  Words are hard to get down in
a clear manner.
>
> thanks,
> Daniel.
>
> --
> Ubuntu-devel-discuss mailing list
> Ubuntu-devel-discuss at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
>




More information about the Ubuntu-devel-discuss mailing list