rubyguides

Tutorial series

Ruby Concurrency

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

  1. Ruby Threads Basics: Thread.new, Mutex, and Queue

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

  2. Ruby Mutexes and Thread Synchronization: A Practical Guide

    Ruby mutexes synchronization guide: use Mutex, Queue, and ConditionVariable to prevent race conditions and coordinate threads safely across Ruby threads.

  3. Ruby Fiber Basics: Yield and Resume Control Flow

    Master Ruby fiber basics with practical examples of yield and resume. Build producer-consumer patterns and learn cooperative concurrency for control flow.

  4. Ruby Ractors: Introduction to Parallel Actors

    Learn Ruby Ractors, the true parallelism model in Ruby 3.0. Master message passing with send, take, yield, and receive for memory-isolated concurrency.

  5. Ruby Async Gem: Fiber-Based Concurrency for I/O

    Learn Ruby async gem concurrency: handle thousands of I/O operations in one thread with the reactor-based event loop and fiber scheduler.

  6. The concurrent-ruby Library: Futures, Actors, and Queues

    Learn the concurrent-ruby library for thread-safe collections, async futures, actors, and synchronization primitives in production Ruby apps.