<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
On 03/04/2023 17:24, Babneet B Singh wrote:<br>
<blockquote type="cite" cite="mid:MW5PR15MB5243105DC27F045E0B5C877FF7929@MW5PR15MB5243.namprd15.prod.outlook.com">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);" class="elementToProof">
<pre style="font-size: 12pt; background-color: rgb(255, 255, 255);" class="ContentPasted0 ContentPasted1">I would like to request clarification on how JVMTI resume and suspend work for a virtual thread and its associated carrier thread.<div>
</div><div class="ContentPasted1">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?</div></pre>
</div>
</blockquote>
They are separate Thread objects for JVM TI too,.<br>
<br>
<br>
<br>
<blockquote type="cite" cite="mid:MW5PR15MB5243105DC27F045E0B5C877FF7929@MW5PR15MB5243.namprd15.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);" class="elementToProof">
<pre style="font-size: 12pt; background-color: rgb(255, 255, 255);" class="ContentPasted0 ContentPasted1"><div class="ContentPasted1">jvmti->SuspendThread(virtualThread) // Will this also suspend the carrier thread?</div></pre>
</div>
</blockquote>
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.<br>
<br>
<br>
<br>
<blockquote type="cite" cite="mid:MW5PR15MB5243105DC27F045E0B5C877FF7929@MW5PR15MB5243.namprd15.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);" class="elementToProof">
<pre style="font-size: 12pt; background-color: rgb(255, 255, 255);" class="ContentPasted0 ContentPasted1"><div class="ContentPasted1">jvmti->SuspendThread(carrierThread) // Will this also suspend the virtual thread?</div></pre>
</div>
</blockquote>
No, the carrier will self-suspend when the virtual mount unmounts.<br>
<br>
<br>
<br>
<blockquote type="cite" cite="mid:MW5PR15MB5243105DC27F045E0B5C877FF7929@MW5PR15MB5243.namprd15.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);" class="elementToProof">
<pre style="font-size: 12pt; background-color: rgb(255, 255, 255);" class="ContentPasted0 ContentPasted1"><div class="ContentPasted1">jvmti->ResumeThread(virtualThread) // Will this resume both virtual thread and its carrier thread?</div></pre>
</div>
</blockquote>
No, just the virtual thread.<br>
<br>
<br>
<blockquote type="cite" cite="mid:MW5PR15MB5243105DC27F045E0B5C877FF7929@MW5PR15MB5243.namprd15.prod.outlook.com">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);" class="elementToProof">
<pre style="font-size: 12pt; background-color: rgb(255, 255, 255);" class="ContentPasted0 ContentPasted1"><div class="ContentPasted1">jvmti->ResumeThread(carrierThread) // Will this just resume the carrier thread and virtual thread will stay suspended?</div></pre>
</div>
</blockquote>
<br>
No, just the carrier.<br>
<br>
-Alan<br>
</body>
</html>