[concurrency-interest] a volatile bug?

Boehm, Hans hans.boehm at hp.com
Wed May 16 14:40:49 EDT 2012


> From: Pavel Rappo
> 
> If you see some concurrent behaviour that violates JMM then what else
> could that be?
A JDK bug AND a serious test suite omission?

But is the problem real?  Can it be reproduced on a mainstream JVM?

Note that the example in the original posting also read b before the loop,
so naïve common subexpression elimination would cause the bug.  Hopefully
nobody does CSE in cases like this.

Hans
> 
> On 16 May 2012, at 20:55, Zhong Yu wrote:
> 
> > as reported on
> > http://stackoverflow.com/questions/10620680
> >
> > basically there are
> >
> >    volatile int a;
> >    int b;
> >
> > Thread 1:
> >
> >    b=1;
> >    a=1;
> >
> > Thread 2:
> >
> >    while(a==0)
> >        ;
> >    if(b==0)
> >        print("error");
> >
> > "error" is seen printed on 32 bit JDK6 on 64bit machine
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrency-interest at cs.oswego.edu
> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 
> 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest



More information about the Concurrency-interest mailing list