I'd like to make a case for making happens-before the terminology that is
used by the wider Java community when talking about multi-threaded programs.
There have been concerns expressed here, and in associated documents, that
people will get confused when they end up making statements like "An event
happens-before another event that it happens before." However, I think that
in that case, the confusion exists in the mind of the speaker even before
the sentence is uttered.
We need to move people away from the notion that they somehow know the
order of events in a program without reference to the rules of the
language, including the JMM. Given two events in separate threads (or
strictly speaking even the same thread), one cannot say anything about the
order in which they occur until one has examined the program in the context
of the language's ordering rules.
When the programmer is asking herself whether she can say that event A
occurs before event B, she has to look for a happens-before relationship.
If there is none, then the statement cannot be made. If event A
happens-before event B, then everything about A is visible to B. This is
the natural everyday meaning of "happens before".
I think that introducing other wording, roach models, or memory barrier
concepts, is just muddying the waters.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:01 EDT