Java / JVM Architecture (Java21) Interview questions
What is the difference between platform threads and virtual threads at the JVM level?
The two thread types differ in how the JVM represents and schedules them, not in the public API a developer writes against.
| Platform Thread | Virtual Thread |
| 1:1 wrapper around an OS thread | JVM-managed continuation, not tied 1:1 to an OS thread |
| Fixed, relatively large stack, often around 1MB, reserved upfront | Small stack stored on the heap that grows and shrinks as needed |
| Scheduled by the operating system | Scheduled by the JVM onto a small pool of carrier platform threads |
| Practical limit: thousands per process | Practical limit: millions per process |
Because a blocked platform thread ties up a full OS thread until it unblocks, thread-per-request servers built on platform threads traditionally had to cap concurrency with bounded thread pools; virtual threads remove that specific constraint by making a "blocked" thread cheap to have millions of.
More Related questions...