<<There are definitely many reasons to prefer native threads over green
threads. This is the reason why you have seen a shift from green threads
to
native threads in MRI, Rubinius, and the JVM.

Why do you want green threads?>>

There are many situations to prefer green threads over kernel
threads.  It's why I'm somewhat surprised that Ruby is just ditching
green threads, vs. keeping them and deploying kernel threads along side
them.  Perhaps it's a cultural thing.  Rubyists might be more concerned
with things like web servers (Rails development) and what not, and
perhaps haven't found want or need for green threads so much (just a
guess).

One reason to prefer green threads is if your application doesn't need
speed up through concurrency/parallelism, rather you want a threaded
solution for algorithmic purposes, convenience purposes, or other
purposes.  This is a crappy example, but say you need to do some
calculation which might fail or even crash, but you don't want (or need)
to check the inputs to the calculation, or wrap the thing up in an error
catching mechanism, or anything of this nature.  You just want to
calculate it, and if it works, fine, and if it doesn't (or even crashes)
- fine, your main program continues to run.  So spawn a green thread to
run the calculation.  If it works, great.  If it crashes, who cares?

You might say "do that with a kernel thread."  But what if I want to
spawn this thread over and over again in a tight loop?  I don't want or
need the monstrous overhead of a kernel thread here.  I just want a
green thread.

Again, there's a whole host of situations where one might want to have
green threads vs. kernel threads.  But I wasn't here to debate that - if
Rubyists want to throw green threads in the garbage, that's their
prerogative.  I was just here to ask whether there were green threads or
not (in 1.9.*).

-- 
Posted via http://www.ruby-forum.com/.