JVMTI resume and suspend for virtual and carrier threads
Chris Plummer
chris.plummer at oracle.com
Mon Apr 3 19:14:56 UTC 2023
On 4/3/23 9:45 AM, Alan Bateman wrote:
> On 03/04/2023 17:24, Babneet B Singh wrote:
>> I would like to request clarification on how JVMTI resume and suspend work for a virtual thread and its associated carrier thread.
>> Virtual thread runs on a carrier thread. Both are separate Java
>> objects. JVMTI functions can be invoked separately on them. What is
>> the relationship between the state of a virtual and carrier thread
>> when JVMTI suspend and resume functions are invoked on them?
> They are separate Thread objects for JVM TI too,.
>
>
>
>> jvmti->SuspendThread(virtualThread) // Will this also suspend the
>> carrier thread?
> No, just the virtual thread. Remember the carrier is "blocked" when a
> virtual thread is mounted, it continues when the virtual thread
> unmounts. Once you get that mental model then most of the
> suspend/resume issues should be become straight forward to reason about.
>
It won't suspend the carrier thread, but the virtual thread remains
mounted on the carrier thread, so the carrier thread continues to be
blocked on the virtual thread, and can't be used to run other virtual
threads.
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230403/f2135831/attachment-0001.htm>
More information about the loom-dev
mailing list