Introduce virtual threads to the Java Platform. Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications.
Virtual threads were proposed as a preview feature by JEP 425 and delivered in JDK 19. To allow time for feedback and to get more experience with the feature, they were proposed again by JEP 436 and delivered as a preview feature in JDK 20. This JEP proposes to finalize Virtual Threads in JDK 21, with only one change from JDK 20.
The one change from JDK 20, informed by developer feedback, is that virtual threads now support thread-local variables all the time. The ability in earlier preview releases to opt-out of having thread-local variables has been dropped. Guaranteed support for thread-local variables ensures that many more existing libraries can be used unchanged with virtual threads, and helps with the migration of task-oriented code to use virtual threads.
It is not a goal to remove the traditional implementation of threads, or to silently migrate existing applications to use virtual threads.