~/talk

Introduction and Pitfalls of Java's New Concurrency Model

Talkat JCON Europe 2023 · on Wednesday, 2023-06-21· at 14:00· Cinema 9, Im Mediapark 1, 50670 Köln, Germany· [java, concurrency]
slides:none on file

Java 20/21 adds virtual threads that create via startVirtualThread or by using newVirtualThreadPerTaskExecutor, and demonstrates structured concurrency with StructuredTaskScope and policies like shutdownOnSuccess to control lifetimes. Scoped values replace ThreadLocal with immutable, method-scoped bindings. Demos create 10k threads on a laptop and report ~100k+ virtual threads using ~225 MB while platform threads crash. Implementation uses carrier (platform) threads that mount/unmount virtual threads; pitfalls include pinned threads (synchronized, JNI, some filesystem calls), long CPU-only tasks, and libraries still relying on ThreadLocal.

AI-written summary · about

  1. 0:00Introduction to Java's concurrency
  2. 2:07Current thread usage in Java
  3. 5:35Problems with executor services
  4. 5:55Async programming challenges
  5. 6:17Virtual threads overview
  6. 8:45Memory efficiency of virtual threads
  7. 9:06Demo: Creating virtual threads
  8. 13:46How virtual threads work
  9. 16:57Pitfalls of virtual threads
  10. 19:26Scoped values introduction
  11. 21:11Thread locals refresher
  12. 26:32Problems with thread locals
  13. 27:16Scoped values benefits
  14. 30:56Scoped values vs thread locals
  15. 32:02Structured concurrency explained
  16. 35:56Demo: Structured concurrency
  17. 42:00Getting started with virtual threads
  18. 42:53Q&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.