[concurrency-interest] Bulk queue operations

Gregg Wonderly gregg.wonderly@pobox.com
Wed, 22 Dec 2004 08:42:57 -0600

David Holmes wrote:
>>I would be happy to have Bulk-Queue stuff in jsr166x/JDK6 because I have
>>the impression that a 'putMany' with a 'takeMany' operations could be
>>more efficient than many 'put' with many 'take'.  Also, we could want to
>>offer many objects atomically.
> Without atomicity, these methods would simply save you from writing a loop.
> I don't think there is much to be gained by internalising that loop.

The multiple put/take operations actually helps the system manage thread 
concurrency better.  The total latency through the system would really 
not change by internalizing the loop.  A different algorithm, or more 
parallelism might improve the system throughput though.  In the end, the 
small amount of total work that each of these operations take, with 
multiple threads running really can't be extract from the system by 
other algorithms without dealing with some of the other considerations 
regarding thread isolation and interaction.

My experience has shown me that if these points of thread interaction 
are in fact the longest running operations in the system, then the 
system is inherently bound by these operations, and you have to remove 
them, or reorganize them to remove the interactions.