Game of Loom 2: life and dead(lock) of a virtual thread
summary
Virtual threads in JVM 21 are stable but carry concrete limits: experiments running 64 CPU-bound tasks on an 8-core machine show groups of eight virtual threads hogging a core due to non‑preemption, and a JMH benchmark with 100 workloads measures virtual threads as twice as slow because mounting/unmounting dominates time. ThreadLocal usage explodes memory with millions of virtual threads so scoped values are needed; carrier behavior is fixed (carrier thread pool is fixed to ForkJoin) and swapping it for an event-loop carrier causes a surprising single-lock deadlock.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:53Virtual threads overview
- 6:15Limitations and challenges
- 11:42CPU bound task concerns
- 17:43Scheduling and cost
- 23:29Thread locals and scope
- 28:51Resource management pitfalls
- 36:13Event loops and deadlocks
- 44:06Conclusion
related talks
31mJava Virtual Threads
47mThe Challenges of Introducing Virtual Threads to the Java Platform - Project Loom
36mA Dev Persepctive on Java Loom
50mVirtual threads - no pain, no gain
37mPrepare for what "Loom"s ahead
01h 13mProject loom: Modern scalable concurrency for the Java platform
57mUnveiling the Magical Power of Java Virtual Threads
01h 00mLoom Virtual Threads in the JDK 20
