Expansion of native thread count by Object.wait() vs Condition.await()

Alan Bateman Alan.Bateman at oracle.com
Mon Oct 9 18:32:14 UTC 2023



On 09/10/2023 18:50, Anton Vodonosov wrote:
> :
> You mean parking while holding a ReentrantLock does not compensate?
> (BlockingQueues call Condition.await() while holding a ReentrantLock).
>
All the locks in j.u.concurrent plan well with virtual threads, meaning 
the underlying carrier thread is released to do other work when a 
virtual thread parks. So no need to compensate in these cases.  The 
limitation is with Java monitors, the built-in locks that are the 
"synchronized" keyword.

-Alan



More information about the loom-dev mailing list