Scrivio Interview library
ConceptPrincipal7 min read · updated 12 November 2026

Java started with green threads on some platforms, moved to one Java thread per OS thread, added executors in Java 5, and added virtual threads in Java 21. Explain why each shift happened and what it tells you about choosing concurrency models for the next decade.

Each shift fixed the main cost of the model before it. Green threads were cheap but ran on one OS thread, so Java moved to one OS thread per Java thread to get real parallelism; those threads were expensive, so Java 5 added executors to reuse a few of them; async and reactive code then worked around the thread limit at the price of hard-to-read code, and Java 21's virtual threads made threads cheap again so we can write simple blocking code at high concurrency. The lesson for the next decade is to prefer the model that keeps code simple when the runtime can carry the cost.

Why this question is asked

Most of us have lived through at least two of these shifts: thread pools tuned by hand, then CompletableFuture chains or Reactor, and now virtual threads. Interviewers at a senior level ask this question because the history explains why our codebases look the way they do, and because someone who understands why each model appeared can judge the next one calmly instead of following fashion. In this answer, we will walk through each era, look at the cost that forced the next change, compare the models side by side, and then draw the lesson for choosing a concurrency model in new systems.

1A Quick Recap: What a Thread Costs

A thread is a sequence of instructions that the machine can run independently of other sequences. Two parties can be responsible for threads. The operating system (OS) has kernel threads, which it schedules onto CPU cores. A runtime such as the JVM can also keep its own lightweight threads and decide itself which one runs next. The relationship between the two is described as M:1 (many runtime threads on one OS thread), 1:1 (each runtime thread is an OS thread) or M:N (many runtime threads spread over a smaller pool of OS threads).

An OS thread is not free. It reserves a stack, typically about 1 MB of address space by default on 64-bit Linux, it needs kernel data structures, and switching between OS threads costs a trip into the kernel. That cost is the thread in every chapter of this story.

2Green Threads: Cheap but Stuck on One CPU

The earliest JVMs on some platforms, notably Solaris, used green threads. The JVM itself scheduled all Java threads on top of a single OS thread, which is the M:1 model. Creating a thread was cheap and switching between them did not involve the kernel, which suited the single-CPU machines of the mid-1990s.

But there is a catch: the OS only sees one thread. Two Java threads can never run on two CPUs at the same time, so a multi-processor server gains nothing. Worse, if one green thread made a blocking system call that the JVM had not wrapped, the single OS thread blocked and every Java thread stopped with it. As multi-processor servers became normal, this limit was unacceptable, and by the Java 1.2 and 1.3 era the JVMs moved to native threads.

3Native 1:1 Threads: Real Parallelism, Expensive Threads

With native threads, each java.lang.Thread is backed by exactly one OS thread. The OS scheduler places them on all cores, blocking I/O blocks only the calling thread, and tools like top, perf and the OS debuggers understand Java threads. This is the model HotSpot has used ever since, and it is still what Thread.ofPlatform() gives us today.

The cost moved elsewhere. Each thread now carries a full OS stack and kernel bookkeeping, so a server can hold a few thousand threads comfortably, not a few hundred thousand. Code written in the natural thread-per-request style, where one thread waits for the database while another serves the next user, hits that ceiling quickly. Notice that the limit is on waiting, not on computing: most server threads spend their time blocked on I/O, holding a stack they are not using.

4Executors in Java 5: Reusing Scarce Threads

Java 5 brought java.util.concurrent, and with it the Executor framework. The key idea is to separate submitting a task from deciding which thread runs it. We hand the executor a Runnable or Callable, and the executor reuses a fixed set of threads to run many tasks.

Java
ExecutorService pool = Executors.newFixedThreadPool(200); // 200 OS threads, reused
for (Request r : incoming) {
pool.submit(() -> handle(r)); // thousands of tasks queue for 200 threads
}

This solved the cost of creating threads and put a bound on how many existed, but it did not remove the ceiling. With 200 threads, at most 200 requests can be waiting on the database at once; request 201 waits in the queue even if the CPU is idle. We tuned pool sizes, split pools per dependency, and still ran out of threads under slow downstream services.

5Async and Reactive: Working Around the Thread Limit

The next step was to stop holding a thread while waiting. CompletableFuture (Java 8), Netty, Reactor and RxJava let a small number of threads start an I/O operation, register a callback, and move on. A service could handle tens of thousands of concurrent requests on a handful of event-loop threads.

The price was paid by the code and the people reading it. Logic that was a few sequential lines became chains of thenCompose and flatMap, stack traces showed framework internals instead of our call path, ThreadLocal context such as MDC needed special propagation, and one accidental blocking call on an event loop could stall everything.

6Virtual Threads in Java 21: Cheap Threads Again

Virtual threads, final in Java 21, return to the M:N idea, done properly. A virtual thread is a java.lang.Thread managed by the JVM; when it blocks on I/O or a lock, the JVM unmounts it, parks its small heap-allocated stack, and lets the carrier OS thread run another virtual thread. One million virtual threads can exist at once on a normal server.

Java
try (ExecutorService ex = Executors.newVirtualThreadPerTaskExecutor()) {
for (Request r : incoming) {
ex.submit(() -> handle(r)); // one new virtual thread per request, plain blocking code
}
} // close() waits for all tasks
Four concurrency models compared
ModelParallel on many coresPractical concurrencyCode style
Green threads (M:1)NoLimited by one OS threadSimple blocking
Native threads (1:1)YesThousandsSimple blocking
Executors on native threadsYesPool size, queue the restTasks, still blocking
Async / reactiveYesTens of thousandsCallbacks and operators
Virtual threads (M:N)YesHundreds of thousands or moreSimple blocking
Every move traded one cost for another; virtual threads are the first to keep both parallelism and simple code.

So we keep the simple blocking style, readable stack traces and normal debugging, while concurrency is limited by memory and downstream capacity instead of by OS threads. Unlike green threads, carriers run on all cores, and the JDK's blocking APIs were rewritten to unmount instead of blocking the carrier.

7What This Tells Us About Choosing a Model

Look at the pattern. Every model that pushed complexity into application code (manual pool tuning, callbacks, reactive operators) was a workaround for a runtime limit. When the runtime removed the limit, the workaround lost most of its reason to exist. The lesson is to prefer the model that keeps code simple, sequential and debuggable whenever the runtime can carry the cost, and to accept complex models only where they buy something measurable.

For the next decade, that means virtual threads as the default for I/O-bound services, with structured concurrency (still a preview API in Java 25, so check its status in your JDK) for fan-out work. Reactive remains valuable where its other features matter, such as streaming with backpressure. And the bottleneck moves: when threads are cheap, the real limits become connection pools, downstream rate limits and memory, so we should bound concurrency with semaphores or pool sizes at those resources rather than with thread counts.

8Follow-up questions

Are virtual threads just green threads again?

No. Green threads ran every Java thread on one OS thread, so there was no parallelism and an unwrapped blocking call froze everything. Virtual threads are multiplexed over a pool of carrier threads, one per core by default, and the JDK's blocking operations unmount the virtual thread instead of blocking the carrier. The idea of cheap runtime-managed threads is old; the implementation is new.

Should we rewrite our reactive services to virtual threads?

Not just because we can. A working reactive service already has its scale; rewriting it costs effort and risk. The case is strongest for new services and for blocking services that hit thread limits. For a reactive service, we would migrate only when the code's complexity is causing real bugs or slowing the team, and measure before and after.

9Conclusion

In this answer, we saw that green threads were cheap but could not use more than one CPU, that native 1:1 threads gave real parallelism at a high cost per thread, that executors reused those scarce threads, and that async and reactive styles worked around the limit by making code harder to write and debug. Virtual threads remove the limit inside the runtime, so simple blocking code can scale again. The lasting lesson is to choose models that keep code simple when the runtime can pay the cost, and to bound concurrency at the real scarce resources.

What to say in the interviewAbout 100 seconds aloud

Open with

I see each shift as fixing the main cost of the previous model. Green threads were scheduled by the JVM on a single OS thread, so they were cheap but could never use more than one CPU, and one blocking call could freeze all of them.

Then, if they want more

The move to one Java thread per OS thread gave real parallelism and good OS tooling, but each thread costs a large stack and kernel resources, so we were limited to a few thousand. Executors in Java 5 separated task submission from thread management, which let us reuse those scarce threads and bound them, but the ceiling stayed.

Async and reactive styles got around it by not holding a thread while waiting, and they paid for it with code that is harder to write, read and debug, plus context propagation problems.

Virtual threads, final in Java 21, make the thread itself cheap: the JVM unmounts a blocked virtual thread from its carrier, so we can have hundreds of thousands and still write plain blocking code.

The lesson I take for the next decade is that complexity in application code is often a workaround for a runtime limit, so I prefer the model that keeps code simple when the runtime can carry the cost.

In practice that means virtual threads by default for I/O-bound services, bounding concurrency at the real limits like connection pools, and keeping reactive for cases where streaming and backpressure are the point.

About this answer

Last updated
12 November 2026
Versions it names
Java 21, Java 5, Java 25, Java 8
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Java started with green threads on some platforms, moved to one Java thread per OS...": https://scrivio-interview-library.netlify.app/java/threads/2d88b13eee/