Hi, I'm absolutely new to Ruby, but one thing I found strange is that
thread.pass takes a very long time compare to sched_yield in C. Does
any one know why is that?
Remember that at this time Ruby uses green threads, not OS threads.
There's an internal thread scheduler in the Ruby interpreter that
takes care of the whole mechanism of Ruby theading, so everything
happens in userspace, and it would necessarily be slower than the
OS-level POSIX threads you seem to be accustomed to using. I believe
there's some work being done to provide native threads for Ruby, but
it won't be available at least until Ruby 2.0 comes out.