I have a question for the list...
Has the issue of fairness in the JMM been thrashed out?  There were a
couple of threads on it (here are pointers to their initial messages):
http://www.cs.umd.edu/users/pugh/java/memoryModel/archive/0619.html
http://www.cs.umd.edu/users/pugh/java/memoryModel/archive/0763.html
The main issue seems to be whether read of volatiles or synchronization
blocks can be lifted out of loops, and if so, can this be done a finite
number of times or an infinite one?  Here are a couple of examples of what
I mean:
Example 1:
Can this:
while (true)
  synchronized (foo)
    { ... } 
Become this:
synchronized (foo)
  while (true)
    { ... }
Example 2:
Can this:
for (i = 0; i < 1 quadrillion; i++)
  synchronized (foo)
    { ... } 
Become this:
synchronized (foo)
  for (i = 0; i < 1 quadrillion; i++)
    { ...}
Example 3:
Is this
Initially all variables are 0 
Thread 1 
  Volatile1 = 1 
  while (A == 0) {;} 
Thread 2 
  while (Volatile1 != 1) {;} 
  print "Success" 
guaranteed to print "success"?
There are other examples out there...  The basic question is what kind of
fairness guarantees need to be included in the spec.  I am not asking if
these are good transformations to make, I am just asking whether or not
the JMM should allow them (or even make mention of them).  
I have to resolve this issue for my JMM simulator, and I think it is an
important one, so if we have come to a consensus, I would like to know
about it.  Thanks!
                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:35 EDT