Grow Your Unix Beard Using Ruby

Published on November 27, 2012 by Jesse Storimer

The video of my Rubyconf talk was posted this week by the fine folks over at Confreaks. The talk introduces basic concepts in Unix system programming, namely: fork+exec. It walks through examples that use these system calls in Ruby, at a high level, then how Unicorn uses them.

If you don't time to watch the talk, just skip to 18:00 and see what I have to say about fork+exec. It's the real takeaway.

This talk is a slimmed-down version of a 2 hour workshop I did internally at Shopify about Unicorn, and system programming in general. In that workshop, there was a lot more live coding. We built a web server that emulated some of the stuff that Unicorn does and I showed the motivation behind some of the design decisions.

I gave a very similar talk at MagicRuby in October, hopefully that video surfaces soon. The first time I gave this particular talk, at MagicRuby, I included some live coding. Well, not so much 'live coding', but source-diving into the Unicorn codebase.

When I was practicing before Rubyconf, I decided to pull this component at the last minute. I thought it interrupted the flow too much. So when I practiced, the talk took about 35 minutes. But then I cut the source-diving and didn't add anything new. On top of that, I must've been talking faster than usual on the stage at Rubyconf because the talk itself was over in about 22 minutes! Thankfully, I got some great questions from the audience. If you stick around to the end, you'll hear stuff like:

  • Processes or threads?
  • My favourite system call
  • How to avoid some of the overhead of a fork+exec
  • Why does fork seem so out of date?