[concurrency-interest] On park and unpark

Andrew Haley aph at redhat.com
Fri Aug 25 05:37:08 EDT 2017

At the bottom of every blocking operation in j.u.c is the park/unpark
pair.  I'm curious about the choice of these primitives.  Herlihy et
al [1] use a mutex/condvar when they want to block (as indeed does
HotSpot's implementation of park/unpark) and I haven't been able to
find park and unpark in high-level lanuguages apart from Java.

To my questions: why use park/unpark in j.u.c?  And where does the
original idea come from anyway?  I see that BSD and Solaris have the
lwp_park syscall so perhaps Java's park/unpark was based on that, but
we don't use lwp_park in HotSpot, even for Solaris.

Maybe park/unpark were actually invented someone at by BSD, but Forth
has used a very similar primitive (STOP and awaken) since the 1970s.
Perhaps the idea is "just obvious" and has been reinvented several

[1] The Art of Multiprocessor Programming, Maurice Herlihy, Nir
Shavit, Morgan Kaufmann, 2011

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