Java / Java 21 Virtual Threads Interview questions
What is a continuation in the context of virtual threads?
A continuation is a low-level JVM construct that captures a computation's execution state so it can be paused and later resumed from exactly where it left off, including its call stack.
Virtual threads are built on top of an internal continuation mechanism: when a virtual thread blocks, the JVM freezes its continuation and detaches it from the carrier thread, then later thaws and resumes it, possibly on a different carrier thread.
Continuations aren't a public Java API; they're an internal implementation detail that makes cheap, JVM-managed thread suspension possible in the first place.
More Related questions...