Inside Ruby: concurrency & garbage collection explained
summary
Explains why Ruby 1.9 keeps a global interpreter lock and how that affects real apps by walking a concrete 10 clients example where even/odd request latency shows sequential ordering then fixes with threads, but still can’t use all CPUs. Covers C extensions’ safety tradeoffs, Ruby 1.9’s lazy-sweep GC change, and benchmarked results like a 20–30% GC improvement and real-world cases (Twitter ~20% CPU in GC) that justify tuning memory before chasing parallelism.
AI-written summary · about
chapters (17)
- 0:00Introduction to Ruby internals
- 1:26Ruby implementations overview
- 5:19Concurrency basics with threads
- 10:42Thread limitations and context switching
- 13:30Green vs native threads in Ruby
- 18:13Why Ruby developers avoid threads
- 21:05Global interpreter lock explained
- 23:34Thread safety and GIL impact
- 25:46C extensions and memory management
- 27:50Should Ruby remove the GIL?
- 30:16CPU-bound vs I/O-bound workloads
- 32:45Memory allocation in Ruby
- 33:27Ruby garbage collection basics
- 35:13Lazy sweeping optimization
- 37:21Why garbage collection matters
- 39:49Key lessons and takeaways
- 41:22Q&A session
