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

Anton Vodonosov avodonosov at yandex.ru
Mon Oct 9 17:05:26 UTC 2023


Hello.

The JEP 444 text says that for Object.wait(), the virtual thread remains
 mounted while blocked, but the scheduler will compensate for that by
temporarily adding a native thread to its ForJoinPool.

But for BlockingQueue.take() the blocked virtual thread not only
remains mounted (and pinned) to the native thread, but also
the scheduler does not compensate for that.

BlockingQueue.take() is implemented using Condition.await().

Object.wait() and Condition.await() are so similar in their semantics.

Is JEP 444 text correct that one is compensated by a temporary
native thread and another is not?

If true, it would be interesting to know why, if anyone can answer.

Best regards,
- Anton


More information about the loom-dev mailing list