[concurrency-interest] On park and unpark

Andrew Haley aph at redhat.com
Fri Aug 25 16:29:57 EDT 2017

On 25/08/17 19:45, Nathan and Ila Reynolds wrote:
> So, if we switch this to a futex, then we can get rid of the 
> cond_wait/cond_timedwait calls.  Is this correct?  If correct, then this 
> change will slightly reduce CPU usage and probably worth the effort.  

It'll get rid of the mutex_trylock and mutex_unlock calls.  It'll
replace the cond_wait/cond_timedwait calls with futex calls.

> The change may reduce the code complexity and reduce maintenance costs.

Sort of.  The current code, although it has had bugs in the past, is
robust enough that it needs very little maintance.  But I take your

> At least, the change will reduce the number of emails about suggesting 
> that park/unpark uses futexes.  ;)

At best, probably.  :-)

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the Concurrency-interest mailing list