From: Charles Oliver Nutter Date: 2008-07-03T08:05:01+09:00 Subject: Re: Threads and Ruby I単aki Baz Castillo wrote: > El Mi辿rcoles, 2 de Julio de 2008, Charles Oliver Nutter escribi坦: >> Robert Klemme wrote: >>> On 02.07.2008 18:29, barjunk wrote: >>>> 4 - Native threads are used in Jruby, and in Ruby 1.9 YARV >>> JRuby yes. I am not sure about 1.9 - I believe native threads are not >>> yet completely supported there. >> Ruby 1.9's threads are native, but they are not allowed to run in >> parallel because most of the core structures in Ruby are not thread-safe >> (as in kernel-level thread safe). > > AFAIK one of the advantages of green threads is that they are a bit faster. > What is the purpose of native threads in Ruby 1.9 if they cannot run in > parallel? I think there are several, but one I know of is that it simplifies the logic required to block on IO without blocking other threads, since you can just let another thread get scheduled (essentially unlock/lock GIL around the blocking IO). I'm not sure if they actually made that change though. Actually, it's probably more of a stepping stone toward full native, parallel threads. And green threads are no faster than regular threads, but are often cheaper to create. - Charlie