[concurrency-interest] fast semaphore

Joseph Seigh jseigh_cp00 at xemaps.com
Tue Apr 10 22:39:03 EDT 2007


Szabolcs Ferenczi wrote:

>
>
> On 07/04/07, Joseph Seigh <jseigh_cp00 at xemaps.com> wrote:
>
>> main benefit
>> is from being lock-free on the fast path.  No thread will block and be
>> suspended
>> waiting for another thread holding a lock.  Adding thread suspend/resume
>> overhead
>> for locking can add considerable delay.
>
>
> I am afraid there is a misbelief about this in this lock-free fever.

loop count     =  20000
queue size     =    200
producer count =     20
consumer count =     20

LinkedBlockingQueue:
runtime        =  3.792727288 secs

ConcurrentLinkedQueue w/ unfair semaphore:
runtime        =  2.481310054 secs

ConcurrentLinkedQueue w/ fair semaphore:
runtime        = 12.406078426 secs

ConcurrentLinkedQueue w/ unfair fast semaphore:
runtime        =  1.433149464 secs

ConcurrentLinkedQueue w/ fair fast semaphore:
runtime        =  1.490469041 secs

--
Joe Seigh


More information about the Concurrency-interest mailing list