Charles Oliver Nutter
8/14/2008 5:17:00 AM
saurabh purnaye wrote:
> Threads and ProcessesMultithreading
>
> Often the simplest way to do two things at once is by using *Ruby threads*.
> These are totally in-process, implemented within the Ruby interpreter. That
> makes the Ruby threads completely portable---there is no reliance on the
> operating system---but you don't get certain benefits from having native
> threads. You may experience thread starvation (that's where a low-priority
> thread doesn't get a chance to run). If you manage to get your
> threadsdeadlocked, the whole process may grind to a halt. And if some
> thread happens to make a call to the operating system that takes a long time
> to complete, all threads will hang until the interpreter gets control back.
> However, don't let these potential problems put you off---Ruby threads are a
> lightweight and efficient way to achieve parallelism in your code.
As has been discussed here many times before, neither Ruby 1.8.6 nor
Ruby 1.9 run threads in parallel. The only implementations currently
that have actual parallel threads are JRuby (for sure) and IronRuby (I
think). So if having things process *actually* in parallel is important
for your app you may want to consider JRuby.
- Charlie