[concurrency-interest] ArrayBlockingQueue: concurrent put and take

Martin Buchholz martinrb at google.com
Wed Jul 2 19:37:20 EDT 2014

LinkedBlockingQueue has a two-lock strategy, but ArrayBlockingQueue does
not.  It took us years to figure out how to get the iterator to behave
perfectly in ABQ, and I'm afraid of touching it again or introducing
additional complexity.  Using a backing array instead of a linked list has
some advantages, but it is hostile to concurrent collection implementers
... yes, even when everything is guarded by a single lock.

On Wed, Jul 2, 2014 at 4:03 PM, vikas <vikas.vksingh at gmail.com> wrote:

> It may be a naive question,  But i have the same question on why ABQ cant
> use
> two-lock algorithm.
> It would be a great help if somebody can point out to me, why two-lock
> algorithm wouldn't work in ABQ. Which scenario or race condition makes
> two-lock algo infeasible in ABQ.  A simple example of that race conditon
> would help a lot.
> Thanks for having such a great mailing a list. I have learned a lot and
> still learning.
> vikas
> --
> View this message in context:
> http://jsr166-concurrency.10961.n7.nabble.com/ArrayBlockingQueue-concurrent-put-and-take-tp1306p11143.html
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> _______________________________________________
> 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/20140702/7b1af450/attachment.html>

More information about the Concurrency-interest mailing list