Creating Asynchronous Applications with Virtual Threads
summary
Recent Java releases add virtual threads and the claim is concrete: by swapping Executors.newFixedThreadPool to Executors.newVirtualThreadPerTaskExecutor code runs many more concurrent tasks without native-thread exhaustion. A demo shows native threads hit OOME around 10k while 100,000+ virtual threads and even a million proceed fine because sleeps and IO unmount the virtual thread from carrier threads. It presents the cores/(1–blockingFactor) sizing rule, warns do not pool virtual threads, and advises: use virtual threads for IO‑bound work, not heavy CPU.
AI-written summary · about
chapters (8)
- 0:00Introduction to virtual threads
- 3:14Threads should vs can
- 15:37Problem with blocking threads
- 21:25Introducing virtual threads
- 36:50How virtual threads work
- 42:11Using virtual threads with executors
- 51:16Q-tips analogy for virtual threads
- 55:41Dos and don'ts of virtual threads
related talks
41mIntroduction and pitfalls of Java's new concurrency model
43mVirtual Threads: Taming the Wild Multithreading Beast
38mIntroduction and pitfalls of Java's new concurrency model
53mVirtual Threads: Ushering in a New Era of Concurrency
38mIntroduction and pitfalls of Java's new concurrency model
45mIntroduction and pitfalls of virtual threads
37mMultiprocessing evolution & virtual threads in Java
51mIntroduction and Pitfalls of Java's New Concurrency Model
