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

Anton Vodonosov avodonosov at yandex.ru
Mon Oct 9 18:47:09 UTC 2023


I understood, thank you.

BlockingQueue.take() by itself is fine. (as well as all other
cases of Contition.await() when holding a ReentrantLock).
They perfectly unmount the virtual thread.

Only in case if in addition they are surrounded by 
synchronized the pinning happens.

So Condition.await() is fully virtual threading ready,
Object.wait() is made close to it by compensation
of a blocked native thread.

Only exotic cases like IO or blockingQueue.take()
within synchronized result in pathological pinning.

Not so bad, actually.

Best regards,
- Anton


More information about the loom-dev mailing list