On 5/9/06, Ashley Moran <work / ashleymoran.me.uk> wrote:
>
> On May 09, 2006, at 8:41 pm, Logan Capaldo wrote:
>
> >
> > On May 9, 2006, at 3:28 PM, Dave Howell wrote:
> >
> >> They seem similar, but by no means identical. My guess is that
> >> Ruby Threads are parallel execution paths within a single OS-level
> >> 'task,' but a Process is handed to the OS to be run as an
> >> independent task at the OS level?
> >>
> >>
> >
> > Yes, but threads can also be implemented at the OS level. (Ruby's
> > threads currently are not).
> >
> >
>
>
> The JRuby project maps Ruby threads to Java threads, and I think they
> in turn get mapped to system threads.  So JRuby probably has a better
> threading model than normal Ruby!  (Still waiting to see what Matz
> turns out for the Ruby VM)
>
> Ashley
>
>

Ruby uses what are often called green threads. The OS is unaware of
them and they operate in the context of a single process/thread under
the OS with all task switching done by the Ruby interpreter. If you
want to create an application with 2000 threads this is actually a
pretty good thing. If you were hoping to spready your work load across
a mutil-core/cpu box, not so much. Also be aware that any OS blocking
operation in an extension will block all of your threads.

For more information on threads you might find
http://www.faqs.org/faqs/threads-faq/part1/ helpful.

pth