Hmmm ... my understanding of the intent was a little bit different:
If a single thread, say T1, writes more than one volatile field, say VA and
VB, in that order, I think all other threads should be required to see
those in that order. That is:
volatiles VA and VB; initially VA = VB = 0;
T1:
{
VA = 1;
VB = 1;
}
T2:
{
if (VB == 1) {
int x = VA;
}
}
I would say that it is _desired_ that x == 1.
However, if Ta writes VA and Tb writes VB, with no other connection between
those writes, then other threads may observes the writes in either
order. Put another way, in T1, the write of VA must be complete, throughout
the system, before the write to VB starts. However, if two writes to
different variables are _concurrent_, then they may be perceived in
different orders by different observers. To get ordering, you have to touch
something _in common_.
I would claim we want _causality_ at a minimum, and that SC is too strong
(for good performance on some hardware). Causality becomes a little more
interesting if you conceive of a write (or read) as something that occurs
over a span of time, rather than at a single moment. You can place one
operation entirely before another only if the second _starts_ after the
first one _completes_.
I would be interested in Bill's and Jeremy's views on this :-) .... Eliot
==============================================================================
J. Eliot B. Moss, Associate Professor http://www.cs.umass.edu/~moss www
Department of Computer Science +1-413-545-4206 voice
140 Governor's Drive, Room 372 +1-413-545-1249 fax
University of Massachusetts moss@cs.umass.edu email
Amherst, MA 01003-9264 USA +1-413-545-3733 Priscilla Coe sec'y
==============================================================================
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:38 EDT