[concurrency-interest] Proposal WeightedLinkedBoundedQueue

Brian Goetz brian at quiotix.com
Thu Nov 30 19:06:30 EST 2006


Although there's a really unfortunate deadlock interaction if you use a
fair semaphore: you have a queue with a bound of 100 and someone tries
to enqueue an object of weight 101.  With a fair semaphore, it's game
over -- no one will ever succeed in enqueuing again.

> Just one more thing - I am not sure if this is going to be a problem in
> your case, but are you aware of potential starvation scenarios? E.g. if
> your queue is full most of the time, and if you have a requestor that
> wants to put a really large object in the queue, it might never get a
> chance to do so (losing competition with other requestors putting
> smaller objects, so that there is never enough space available for the
> big guy). In the semaphore-based approach, you could prevent this by
> using a fair semaphore. If you're doing it by hand, you might want to be
> careful about this.




More information about the Concurrency-interest mailing list