From: ptkwt@... (Phil Tomson) Date: 2005-07-26T05:35:59+09:00 Subject: Re: Ruby and threads (Sydney) In article , Phil Tomson wrote: >In article <51266.66.192.236.118.1122291266.squirrel@devsea.com>, >John Wells wrote: >>Guys, >> >>Was looking through the forums at ruby-ide.com when I noticed the >>following comment: >> >>"Unfortunately i can't use ruby for scripting/extending/implementing as >>ruby does not work with multiple native threads and i already have one >>ruby thread that is doing the background parsing." >> >>Can anyone elaborate on this? How does it effect folks developing in >>Ruby, and curiously, why does Python seem to support it and Ruby doesn't? >> > >It's because there are a lot of globals defined in the Ruby interpreter so >it's not threadable (native threadable, that is). > >However, recently there have been some interesting developments with an >experimental Ruby interpreter called Sydney. Here's a quote from the >weblog page where it was announced: > > "Sydney is an experimental fork of 1.8.2 that adds a number of features, > such as: > > * Native OS Threads (Thread::OS). These do not replace the normal > Threads, and allow for MxN thread setups (see > test/sydney/test_osthread.rb#test_mxn). There is a lot to be said about > these, so lets move on for now. > ... > > In getting OS threads implement, the core of the interpretter has been > modified to be reentrant and thread-safe, allowing mulitple threads to > run concurrently. > > All globals have been cleaned up and moved into a unified ruby_state > struct (accessable directly in the form of Ruby::State objects). " > >This way you can get the best of both worlds - Ruby's current >cross-platform 'green' threads and native threads if you need them. I >hope that this makes it back into the 'official' Ruby interpreter. > > Ooops. Forgot to include a link to Sydney: http://blog.fallingsnow.net/articles/category/Sydney Phil