[concurrency-interest] General Question on queue-size
stuff at kai.meder.info
Mon May 31 10:51:35 EDT 2010
there was a discussion about the ConcurrentLinkedQueue regarding a
proper size implementation. One Point was that offer and poll would
fight for an atomic Counter, resulting in a huge performance penalty.
Another Point was the general "asynchronous" nature of the offer- and
poll-operations, so the size would only be a rough estimate.
However is the following not possible either?
- offer increments an offerCounter
- poll increments a pollCounter
- estimatedSize = offerCounter - pollCounter
Is this practicable?
I am looking for a way to implement a BoundedQueue where the producer is
stopped after the buffer is full (bounded). However I am not able to use
the existing Queues as they are blocking. I experiment with
Continuation-Passing-Style (reset/shift) in Scala and must not use any
Any comment appreciated. Thanks.
More information about the Concurrency-interest