[concurrency-interest] ConcurrentLinkedQueue unexpected behavior ?

Hanson Char hanson.char at gmail.com
Wed Apr 11 12:24:07 EDT 2007


Nice catch.  Thanks, Doug.

I am still intrigued by CLQ and the liveness problem in CLBQ.  Will
dig further into it.

Hanson Char

On 4/10/07, Doug Lea <dl at cs.oswego.edu> wrote:
> Hanson Char wrote:
> > Here is the proof:
> >
> > Running the following test, occasionally I got both x and y as null:
> >     http://svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-test/dl/TwoConcurrentLinkedQueueLoops.java?view=markup
> >
> > (In the test, x is referred to as result.r1, and y as result.r2)
> >
>
> This doesn't seem to be testing the property that you stated,
> that is:
>
> T1           T2
> q1.offer     q2.offer
> x=q2.poll    y=q1.poll
>
> Your test starts up a large number of pairs, each using the same
> queues. This allows, for example, the sequence involving
> added thread T3, that is conceptually a member of
> a different pair:
>
> T2: q2.offer
> T2: y=q1.poll => null
> T3: q1.offer
> T3: q2.poll => nonnull
> T1: q1.offer
> T1: x=q2.poll => null
>
> So, both x and y can be null.
>
> -Doug
>


More information about the Concurrency-interest mailing list