Can continuation support finally solve the "How do I stop this thread" problem?

Ron Pressler ron.pressler at
Fri Sep 2 16:52:14 UTC 2022

> On 2 Sep 2022, at 16:15, Archie Cobbs <archie.cobbs at> wrote:
> OK, it sounds like you're saying that there exists some system call X from which we can't unblock a thread.
> So what happens when a virtual thread invokes X? Isn't that going to "lock up" the underlying platform thread (or whatever) while X is blocked?

Yes, and that’s what happens for most filesystem operations. We will employ io_uring, where available, to use non-blocking filesystem operations, but until then (or where io_uring is not available) we compensate by adding more OS threads to the scheduler because there’s nothing the user can do to avoid it (see JEP 425). User-mode threads/coroutine implementations in other languages also suffer from this limitation. User-mode code can only work within the confines of the APIs provided by the OS.

However, blocking the OS thread has a significant impact on throughput only if it happens frequently and takes a long time, and so most servers will probably not be impacted by this (when using fixed-size thread pools, as most servers do today, the situation isn’t any better and probably worse).

— Ron

More information about the loom-dev mailing list