Cooperative vs preemtive scheduling of virtual theads

Andrew Haley aph at redhat.com
Mon Jun 8 09:05:45 UTC 2020


On 06/06/2020 16:59, Alan Bateman wrote:
> Virtual threads are pre-emptive, the scheduling points are locking or
> blocking I/O operations. It's not cooperative in the sense that there
> isn't the equivalent of an "await" in other languages.

Just a terminology nitpick, for clarity: every co-operative scheduler
I ever used switched tasks at locks and blocking I/O operations. I
believe this is standard terminology.

One of the problems with this way of thinking, though, is that beneath
abstraction layers client code can't tell what might block. For
example, any call might be to code that loads new classes, thus
blocking. So, in principle, any call site can switch tasks.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the loom-dev mailing list