Threading and concurrency are hot topics in the Ruby community.
Want to join the conversation?

You've probably heard people around you talking mutexes, race conditions, or the GIL. Do you wonder what the heck they're talking about?

This book is a gentle introduction to these concepts and will give you the knowledge you need to become your teams resident concurrency expert.

Working With Ruby Threads
"If you've been avoiding learning about concurrency because you thought it was too confusing, buy this book! It's accessible to the complete beginner, and very well written."

— Gregory Brown (

Convinced? Jump straight to the packages.

In the past, Ruby's concurrency story was rough. But over the last few years, the community has done a ton of work to improve the status quo. Unfortunately, due to the myriad of fast-moving changes and new options, there's been FUD and common misconceptions, leaving some people in the dark.

This book will help you get the story straight when it comes to multi-threaded concurrency in Ruby.

Stuff you'll learn from this book

What readers say

Pat Shaughnessy
"Great topic and an interesting read. [..] Reading this makes me want to go off and start using the Thread class and writing my own threaded code right now."

~ Pat Shaughnessy (

Gabriel Malkas
"I've read articles about concurrency before, and it's easy to get lost in the theory and the semantics. [..] You did a great job of demystifying what is a quite difficult subject in a very enjoyable way."

~ Gabriel Malkas (

Greg Maza
"Great breakdown that allowed me to not only grasp your point but to absorb it and test it myself. I wish all complex concepts could be so clearly explained."

~ Greg Maza - RoR enthusiast

Joe James
"In particular I like the pace of the book, by focusing on something small to learn in each chapter I felt like I was making constant progress, and if I only had 5 or 10mins here and there I would still be able to further my knowledge on the subject and not get bogged down in heavy concepts."

~ Joe James

Steve Hansen
"Just finished "Working with Ruby Threads", it was really enjoyable and informative. You did a great job at making threads very approachable and straightforward."

~ Steve Hansen

Bill Laboon
"Started reading today and can't put it down. Not many programming books are page-turners like this one - I'll probably be using what I learned this weekend by lunchtime tomorrow at the latest."

~ Bill Laboon (

Marcin Pyla
"I am working on some low level application code and your book is my bible."

~ Marcin Pyla

Who is this for?

One of the main reasons this book exists is to help you ask the right questions.

Some folks ask: "are threads better? faster?". As always, the answer is: "well, that depends...". The more important questions are the ones that give you a foundational understanding of multi-threaded concurrency. With this, you can make the right decisions about where and when to use it.

If you are looking for answers to any of the following questions, then you're in the right place.

If you already know the answer to these questions, or are already an expert based on your experience from other languages, then this probably isn't for you.

This is aimed at intermediate Ruby developers. You should have basic experience writing Ruby, but maybe don't have a strong background when it comes to concurrency.

The Details

The Book

The book starts with an introduction to how threading works at a high level, showing you what your programs look like with multiple threads at play. This is where you first hear about things like context switching and race conditions.

From there, you'll get a safari tour of Ruby's Thread API, followed by a deep dive into the infamous GIL: its effects, its implementation, and the reason it's there. Next you'll see how the JRuby and Rubinius don't have a GIL, and how this affects multi-threaded code.

The second half of the book is all about thread-safety. What it means, what it looks like, how to write thread-safe code, how to recognize thread-dangerous code, and what options Ruby gives you for staying safe.

The second half ends with a look at abstractions on top of threads (such as Actors). It wraps up by walking through some real-world, multi-threaded code.. You'll get to see a selection from the Puma web server, and one from the Celluloid-based Sidekiq project, bit by bit with explanations along the way.

  • 167 page PDF with lots of code samples
  • e-reader formats for ePub, MOBI, and TXT
  • directory of sample code from the book for further tweaking
  • DRM free
  • Read a sample chapter

The Interviews

I find reading a book has a very 'clean-room' kind of feel, sometimes lacking that candid, real-world edge. I interviewed 4 different folks with a ton of battle-hardened experience when it comes to multi-threaded Ruby concurrency.

Compared to the book, the interviews give a different perspective on the wider topic of multi-threading in the Ruby community, especially when it comes to production endvironments.

All interviews come with a full transcript.

Mike Perham

Mike talks about the state of thread-safety in the Ruby community, Sidekiq internals, and why you shouldn't use

Mike Perham, author of Sidekiq

Mathias Meyer

Hear stories from the trenches with Mathias. Learn how a piece of Travis' infrastructure began as a single process with many threads, the problems they had, and what they did about it.

Mathias Meyer, Infrastructure Head Honcho at Travis CI

Brian Shirai

Hear about Ruby concurrency from someone who's implemented it! Brian shares a lot of insight about Rubinius internals, the GIL, and how to think about concurrency.

Brian Shirai, Rubinius Developer

Tony Arcieri

Tony discusses his history with Ruby concurrency, some finer points of Celluloid, immutable data structures, and what to expect for Celluloid 1.0.

Tony Arcieri, author of Celluloid

Team License

Get it for the whole team! The team license is good for 50 licenses so your whole team can take advantage.

You choose...

  • Ebook

  • +
  • Interviews

  • +
  • Transcripts

  • +
  • Team License

  • Ebook

  • +
  • Interviews

  • +
  • Transcripts

  • Ebook

My Money-back Guarantee

If it's not working for you then it's not working for me.

If, for any reason, you're not happy with what you get just send me an email: I'll give you your money back and you keep everything. I want you to be happy.


Who am I?

Hi, I'm Jesse Storimer. Previously I solved hard problems at Shopify, one of the largest, busiest Ruby on Rails sites on the web. My journey into the world of multi-threaded programming started while working on Shopify's infrastructure and still continues today.

I really enjoy digging into low-level stuff with Ruby, like implementing a Unix shell, forking processes to speed up Rails test runs, writing an evented IO system, or experimenting with concurrent data structures.

I've published two other ebooks about system programming with Ruby: Working with Unix Processes and Working with TCP Sockets.

I live up in rural Canada with my family. I'm @jstorimer on Twitter. And, yes, I'm working on my Unix beard.

If you have a question, you're not sure if the book is right for you, or you're looking fora team license, email me at I'm happy to help.