Game of Loom: implementation patterns [...] playing with virtual threads
summary
Implements Conway’s Game of Life with CSP channels and runs JMH benchmarks comparing native threads vs virtual threads; virtual-thread runs hit 7× faster on 1k–5k cells, native runs go OOM at 50,000 cells OOM, and average CPU-bound frame time drops from ~2.8s to ~1.9s. Root causes: native does thousands more kernel context switches and steals time, virtuals cause more cache misses, pinning and GC pressure from stacks matter. A custom rendezvous channel yields ~2.5× extra speed; non‑preemptive scheduling creates a non‑preemptive fairness tradeoff.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:32Why virtual threads
- 3:07Memory footprint
- 5:41Do you really want this
- 6:54Why virtual thread
- 14:43Blocking call
- 16:28Context switch
- 19:26Not preemptive
- 28:14Communication channel
- 34:30Frame graph
- 39:20Channel implementation
- 44:07Conclusions
related talks
51mGame of Loom: implementation patterns and performance implications playing with
50mGame of Loom: implementation patterns and performance implications
47mGame of Loom 2: life and dead(lock) of a virtual thread
31mJava Virtual Threads
36mA Dev Persepctive on Java Loom
47mThe Challenges of Introducing Virtual Threads to the Java Platform - Project Loom
57mUnveiling the Magical Power of Java Virtual Threads
53mVirtual Threads: Ushering in a New Era of Concurrency
