~/talk

Introduction and pitfalls of virtual threads

Talkat GeeCON Prague 2023 · 2023-10-19..10-20· [java, concurrency]
slides:none on file

Java 21 adds virtual threads and structured concurrency and demonstrates that thousands scale: the demo creates 10,000 virtual threads demo on a laptop and benchmark shows 100,000 virtual threads ≈225MB where platform threads ran out of memory. Details cover carrier threads, mounting/unmounting stacks, pinning pitfalls (synchronized, JNI, certain file ops), a virtual-thread-per-task executor, run flags to detect pinning, and a custom StructuredTaskScope that cancels remaining tasks when a product <100 is found, which works as shown.

AI-written summary · about

  1. 0:00Introduction to virtual threads
  2. 1:57Platform threads explained
  3. 4:28Limitations of platform threads
  4. 7:17Virtual threads introduction
  5. 10:12Creating virtual threads demo
  6. 13:44Scaling virtual threads demo
  7. 14:48How virtual threads work
  8. 18:21Pitfalls of virtual threads
  9. 21:09Structured concurrency explained
  10. 25:22Structured concurrency demo
  11. 29:37Custom structured concurrency
  12. 33:12Virtual threads takeaways
  13. 33:34Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.