Ruby threads are limited due to the Global Interpreter Lock. Therefore, the best way to do parallel computing with Ruby is to use multiple processes but how do you get these processes to communicate?
This session will provide some strategies for handling multi-process communication in Ruby, with a focus on the use of TupleSpaces. A TupleSpace provides a repository of tuples that can be accessed concurrently to implement a Blackboard system. Ruby ships with a built-in implementation of a TupleSpace with the Rinda library.
During the session, Luc will demonstrate how to use Rinda and will highlight other libraries/projects that facilitate interprocess communication and parallel computing in Ruby.
2. The Free Lunch is Over: A Fundamental Turn Toward Concurrency in Software Source: http://www.gotw.ca/publications/concurrency-ddj.htm “ The major processor manufacturers and architectures have run out of room with most of their traditional approaches to boosting CPU performance. Instead of driving clock speeds ands straight-line instruction throughput ever higher, they are instead turning en masse to hyperthreading and multicore architectures. […] And that puts us at a fundamental turning point in software development, at least for the next few years...” – Herb Sutter – March 2005
3. Outline 1. The problem with Ruby Threads 2. Multiple Ruby Processes 3. Inter-process Communication with TupleSpaces
4. PART 1 The Problem With Threads A closer look at the Ruby threading model
52. “ Writing multi-threaded code is really, really hard. And it is hard because of Shared Memory.” – Jim Weirich The Other Problem with Threads http://rubyconf2008.confreaks.com/what-all-rubyist-should-know-about-threads.html
88. “ Erlang provides a sledgehammer for the problems of concurrent programming. But, sometimes you don't need a sledgehammer... just a flyswatter will do.” – Tony Arcieri