~/talk

Introduction and pitfalls of Java's new concurrency model

Talkat GeeCON 2023 · 2023-04-19..04-21· [java, concurrency]
slides:none on file

Java 19 introduces lightweight virtual threads and a virtual-thread-per-task Executor that let the JVM create hundreds of thousands of threads cheaply; demo creates 100,000 sleeping threads without OOM. Use the static startVirtualThread or the new executor and manage lifetimes with StructuredTaskScope (shutdownOnSuccess/shutdownOnFailure) to auto-cancel siblings. Pitfalls: blocking native or synchronized calls pin a virtual thread to its carrier, long CPU-bound work should not run on them, and thread pools aren’t the right limiter.

AI-written summary · about

  1. 0:00Introduction to virtual threads
  2. 1:32Current Java concurrency model
  3. 6:52What are virtual threads
  4. 9:01Virtual threads demo
  5. 14:23How virtual threads work
  6. 17:36Pitfalls of virtual threads
  7. 19:02What is structured concurrency
  8. 22:57Structured concurrency demo
  9. 27:55Custom shutdown policies
  10. 31:25Benefits of structured concurrency
  11. 32:10Q&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.