[concurrency-interest] On park and unpark
david.dice at gmail.com
Fri Aug 25 15:12:56 EDT 2017
I've tried the futex (with the PRIVATE wait and wake) operators and didn't
see appreciable difference between that approach and the existing
mutex-condvar form. If we're really going to block or unblock threads, the
extra overheads from the mutex-condvar layer are a tiny fraction of the
The mutex should suffer contention infrequently, so the main cost of the
mutex-condvar form is arguably the atomics -- a local cost -- associated
with the mutex.
When I've floated the idea direct futex usage, folks have expressed concern
about the portability & stability of the interface over the wide range of
supported linux distributions. This strikes me as a reasonable concern.
(We prefer "PRIVATE" for instance, but do all targeted distributions
support that flavor?).
p.s., it might make sense to check that the virtual address placement of
condvar -- which is fairly regular -- doesn't interact poorly with the
futex hash chain function, possibly resulting in excessive collisions and
poor distribution over the chains. This issue would apply to both direct
futex usage and the condvar-mutex forms.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest