Concurrency in Ruby: Threads, Fibers and Ractors Demystified
summary
Ruby 3 adds real options: threads give concurrency but not parallelism because the GIL serializes Ruby bytecode; fibers are developer-controlled, lightweight (creating 100 fibers vs 100 threads is much cheaper) and work well with the Async gem and Async::IO for nonblocking I/O but require explicit yield/resume and risk starvation; Ractors run in isolated memory, communicate with send/receive or yield/take, enable true parallel CPU work (example: chunk 10,000 items across 4 ractors) and show ~3x speed in CPU-bound benchmarks, but ractor-compatible gems and limited shareable objects remain constraints.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 2:01Concurrency vs Parallelism
- 4:28Working with threads
- 8:14Fibers and Async
- 14:03Introduction to Ractors
- 19:32Ractor examples and limitations
- 24:53Q&A session
related talks
27mIn-Depth Ruby Concurrency: Navigating the Ruby concurrency landscape
26mConcurrency in Ruby: From fork() to Fiber
54mConcurrency: Rubies, plural
20mSubprocesses, Threads and Fibers
39mConcurrent Systems in Ruby
23mConcurrency Showdown: Threads vs. Fibers
23mParallel Processing With Ruby
28mCome Discuss Ractors and Concurrency with 'The Dude'!
