Boost logo

Boost :

Subject: Re: [boost] [thread] semaphore
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-09-18 07:03:28


>> many use cases is not necessary. and locks are not free, as they involve
>> memory barriers and atomic operations. and how many platforms implement
>> PI mutexes?
>
> Don't semaphores involve memory barriers and/or atomics too? POSIX
> semaphores do.
>
> (N.B. I'm not disputing that semaphores have less overhead than CVs.)

they do, but much less: according to some micro-benchmarks with much
contention, dispatch semaphores on osx are about 80 times faster than
CVs, while posix semaphores on linux are about 30 times faster.




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk