[concurrency-interest] a volatile bug?

R.A. Porter coyotesqrl at gmail.com
Wed May 16 14:57:27 EDT 2012


I was able to duplicate this with two different versions of the HotSpot
client on my Windows 7 box:
1.6.0_31
and
1.6.0_14

-r

On Wed, May 16, 2012 at 11:40 AM, Boehm, Hans <hans.boehm at hp.com> wrote:

> > 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
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120516/d0f5611d/attachment.html>


More information about the Concurrency-interest mailing list