Chapter 3. The Mechanics of Modern Concurrency in Java
Knowing how to use something is important, but understanding how it works is essential. By understanding its inner workings, we not only gain greater appreciation for it, but also can quickly fix any problems that arise. That’s why knowing how virtual threads were implemented and their internals is crucial for a well-grounded Java developer. In this chapter, we will reveal some of the aspects of how virtual threads internally work and are implemented.
We must know two concepts to understand how virtual threads were implemented. One is the ForkJoinPool, and the second is Continuation. ForkJoinPool is a scheduler that schedules virtual threads. Continuation is an aspect of how virtual threads can pause their execution and then resume where they were paused. We will begin by introducing the thread pool, and then gradually get into the depth of the ForkJoinPool and how it’s implemented slightly differently to accommodate virtual ...
Get Modern Concurrency in Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.