Virtual Threads: Ushering in a New Era of Concurrency
summary
Project Loom adds lightweight virtual threads in JDK 21 (JEPs 425, 436, 444) that let Java run millions of concurrent tasks cheaply: demos create 10 million virtual threads and replace pools by Executors.newVirtualThreadPerTaskExecutor or Thread.ofVirtual().start, cutting a 10k-task sleep-based benchmark to ~63 ms (claimed ~99% speedup). Virtual threads sit on a small set of platform carriers so CPU-bound work still uses platform threads; beware pinning by synchronized/native calls and use ReentrantLock or JFR to diagnose.
AI-written summary · about
chapters (8)
- 0:00Introduction to virtual threads
- 10:48Limitations of traditional threads
- 20:07Creating and using virtual threads
- 27:59How virtual threads work under the hood
- 33:50Pitfalls and best practices with virtual threads
- 40:23When to use virtual vs platform threads
- 47:23Virtual threads vs reactive programming
- 51:42Closing and resources
related talks
01h 00mLoom Virtual Threads in the JDK 20
31mJava Virtual Threads
49mEven threads are now virtual:past, present, future of concurrency in Java.
52mJava Virtual Threads
47mThe Challenges of Introducing Virtual Threads to the Java Platform - Project Loom
49mPrepare for what “Loom”s ahead.
47mConcurrent and Asynchronous Programming: Loom in Java 20 and 21
41mIntroduction and pitfalls of Java's new concurrency model
