Introduction and pitfalls of Java's new concurrency model
summary
Java 20/21 brings Project Loom virtual threads that let the JVM create thousands cheaply, demonstrated by running 10,000 virtual threads on a laptop; they run on a small number of OS carrier threads and swap via mounting/unmounting. Structured concurrency (StructuredTaskScope) provides shutdown policies — shutdown-on-success, shutdown-on-failure — and examples show custom scopes to stop when a product under a price is found. Watch for pitfalls: pinning (synchronized, native calls, some filesystem ops) and long CPU-bound tasks that negate benefits.
AI-written summary · about
chapters (12)
- 0:00Introduction to talk
- 0:23Current Java concurrency model
- 1:05Virtual threads overview
- 6:09Creating virtual threads
- 9:19Demo virtual threads
- 13:16How virtual threads run
- 15:44Pitfalls of virtual threads
- 17:34Structured concurrency intro
- 21:07Structured concurrency demo
- 25:50Custom shutdown policies
- 29:28Summary and next steps
- 30:11Q&A session
related talks
38mIntroduction and pitfalls of Java's new concurrency model
51mIntroduction and Pitfalls of Java's New Concurrency Model
41mIntroduction and pitfalls of Java's new concurrency model
38mIntroduction and pitfalls of Java's new concurrency model
45mIntroduction and pitfalls of virtual threads
41mStructured Concurrency in Java: The What & Why
53mVirtual Threads: Ushering in a New Era of Concurrency
47mConcurrent and Asynchronous Programming: Loom in Java 20 and 21
