Archive for May, 2011

Taking advantage of multithreaded environments with Ruby

If you have ever tried to write parallel scripts / applications using Ruby’s threads, you may have stumbled over the fact that, sometimes, some cores are left unused. You may be especially sad if you notice that your brand new war-machine, with 2 physical cores or more, is not fully exploited.

Then, you would be right to wonder if using Ruby and taking advantage of multicore (i.e. writing multithreaded applications) are compatible.

The simple answer is yes. Let’s dig into the more complicated answers: we’ll first explain how Ruby’s threads work, then explain why they sometimes seem to be broken, and eventually suggest four efficient solutions to get rid of their limitations.

Read more…


Get every new post delivered to your Inbox.