[concurrency-interest] ArrayBlockingQueue: concurrent put and take

√iktor Ҡlang viktor.klang at gmail.com
Thu Jul 3 05:35:51 EDT 2014


I think it was a mistake to have the BlockingQueue interface too broad. (A
general issue with the JDK collections)
(There's also a lack of non-blocking SPSC, MPSC and SPMC queues in the JDK.)


On Thu, Jul 3, 2014 at 1:37 AM, Martin Buchholz <martinrb at google.com> wrote:

> 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
>>
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>


-- 
Cheers,
√
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140703/b0aa4e75/attachment-0001.html>


More information about the Concurrency-interest mailing list