waiting room and monitor lock aq.

David Holmes david.holmes at oracle.com
Mon Jul 21 22:16:26 UTC 2014


On 21/07/2014 10:38 PM, Winnie JayClay wrote:
> Hi, is there any order between threads which wake up by notifyAll and those
> trying to acquire obj monitor (blocked after synchronized invocation)? Is
> it mentioned in JLS?

Ordering is completely unspecified. An implementation is free to do what 
it likes to optimize performance (using whatever metric it chooses).

So for example a thread that is woken up by a notify/notifyAll and is 
placed into the monitor acquisition queue need not be given preference.

In general in hotspot the queues are simply FIFO, but the monitor 
implementation also allows barging and monitor release does not perform 
a hand-off.

David

> Thanks.
>


More information about the hotspot-dev mailing list