Robert K. wrote:
On 02.03.2011 22:30, Jörg W Mittag wrote:
Eric W. wrote:
Raphael B.[email protected] wrote:
As ruby threads are so called green threads, what’s the behaviour when
one thread is blocked on IO?
They’re only green threads on Ruby 1.8, 1.9 uses native threads.
That’s not true. The vast majority of Ruby 1.8 implementations use
native threads, and I think there is at least one Ruby 1.9
implementation which uses green threads.
Really? Which are those?
Ruby 1.8 implementations which use native threads:
- JRuby (uses JVM threads, which are native on most JVMs, certainly
the ones that people actually use)
- XRuby (same)
- IronRuby (same, but for CLI threads)
- Cardinal (I think)
- … probably a few others …
As for a Ruby 1.9 implementation that uses green threads, I distinctly
remember reading about one, but I forgot which one. There’s so many
Ruby implementations right now that it’s hard to keep track of which
ones are 1.8 or 1.9 (or both), which ones have native threads or green
threads, which ones have concurrent threads or serialized threads.
(Interestingly, I haven’t seen any implementations with concurrent
green threads, which IMO is the best kind of threads. Rubinius
originally planned to do concurrent green threads, but they never did.
They started off with serialized green threads, then switched to
serialized native threads and are currently in the process of
switching to concurrent native threads.)