rubyguides

Tutorial series

Ruby Concurrency

6 tutorials — follow in order for the best learning path.

  1. Threads Basics in Ruby

    Learn Ruby's threading model: creating threads, synchronization with Mutex and Queue, avoiding deadlocks, and understanding the GVL.

  2. Mutexes and Synchronization in Ruby

    Safely coordinate threads in Ruby using Mutex, Queue, and ConditionVariable to prevent race conditions and build producer-consumer pipelines.

  3. Fiber Basics in Ruby

    Learn Ruby's Fiber class for cooperative concurrency. Master pause-resume control flow with Fiber.yield, Fiber.resume, and Fiber#transfer.

  4. Ractor Introduction in Ruby

    Learn Ruby's Ractor — a true parallelism model introduced in Ruby 3.0. Understand actor-model message passing and memory isolation without mutexes.

  5. The Async Gem in Ruby

    Handle thousands of concurrent I/O operations in Ruby with fibers and the async gem's reactor-based event loop.

  6. The concurrent-ruby Library

    Learn how concurrent-ruby simplifies thread-safe collections, async futures, actors, and synchronization primitives for production Ruby apps.