RFR: 8338383: Implement JEP 491: Synchronize Virtual Threads without Pinning [v9]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Fri Oct 25 18:50:23 UTC 2024
On Fri, 25 Oct 2024 18:39:54 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
>>> The "waiting list" here is just a list of virtual threads that need unparking by the Unblocker thread - right?
>>>
>> Yes.
>
>> Some comments here about the operation would be useful.
>>
> Added a comment.
> I'm struggling to understand how a thread can already be on this list?
>
With the removal of the _Responsible thread, it's less likely but it could still happen. One case is when the virtual thread acquires the monitor after adding itself to `_cxq` in `ObjectMonitor::VThreadMonitorEnter`. The owner could have released the monitor in `ExitEpilog` and already added the virtual thread to the waiting list. The virtual thread will continue running and may face contention on a different monitor. When the owner of this latter monitor picks the virtual thread as the successor it might still find it on the waiting list (unblocker thread did not run yet). The same case can happen in `ObjectMonitor::resume_operation` when acquiring the monitor after clearing successor.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21565#discussion_r1817194346
More information about the nio-dev
mailing list