<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 21/08/2024 09:13, Rick Hendricksen
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:DB9PR07MB8633B4F44DD1B339E7EA14B18C8E2@DB9PR07MB8633.eurprd07.prod.outlook.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}span.EmailStyle22
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}ol
        {margin-bottom:0cm;}ul
        {margin-bottom:0cm;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="en-NL">Hi Alan,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-NL"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-NL">Thanks for taking the
            time to help us with this issue.
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="en-NL"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-NL">We see three problems
            with using the default scheduler with maxPoolSize:<o:p></o:p></span></p>
        <ul style="margin-top:0cm" type="disc">
          <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-NL">Other virtual threads which are not directly
              related to the simulation would slow down the simulation<o:p></o:p></span></li>
          <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-NL">Running multiple simulations in parallel
              would not be possible</span></li>
        </ul>
      </div>
    </blockquote>
    In that case, parallelism means several VMs, each running with
    maxPoolSize=1, rather than running several simulations in the same
    VM at the same time.<br>
    <br>
    <br>
    <blockquote type="cite" cite="mid:DB9PR07MB8633B4F44DD1B339E7EA14B18C8E2@DB9PR07MB8633.eurprd07.prod.outlook.com">
      <div class="WordSection1"><br>
        <ul style="margin-top:0cm" type="disc">
          <li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="en-NL">We need full control over which thread runs,
              and how to treat yield. If the thread is yielding because
              of a simulation-related blocking operation, we want to run
              the next thread. If it’s yielding due to IO, we don’t want
              to switch to another thread. If IO wait would result in a
              yield, that would be unpredictable, and would affect the
              result of our simulation.<o:p></o:p></span></li>
        </ul>
        <p class="MsoNormal"><span lang="en-NL"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="en-NL">It would be very helpful
            for us if custom schedulers would be exposed. Could you tell
            us more about the explorations you mentioned? And is it an
            option to take our use case into account there?<o:p></o:p></span></p>
        <br>
      </div>
    </blockquote>
    There are two explorations at this time. One is allowing the
    scheduler be selected at virtual Thread create time, like the
    prototype API on the builder that was in EA builds for a long time
    but didn't get any feedback. One of the use-cases for this is
    servers that want to use their own event loop thread as a carrier to
    avoid hand-off. The other exploration is exposing a way to replace
    the system-wide scheduler for servers that want to manage their own
    thread pool rather than use a work stealing scheduler. We talked
    about this a bit at JVMLS 2024, I think the recordings will be
    posted soon. <br>
    <br>
    Note that the problem space and the possible interface for custom
    schedulers is larger than might initially seem. You touched on
    exposing the "reason" for preemption and that is one of several
    things that a scheduler may need to be notified of. One thing that
    would be useful to know from your experiments is how you distinguish
    between your "<span lang="en-NL">simulation-related blocking
      operation" and the dozens of other possible cases where a thread
      may be preempted.</span><br>
    <br>
    In any case, the summary on this topic is that it is being explored
    again but proceeding with great caution.<br>
    <br>
    -Alan<br>
  </body>
</html>