small medium large xlarge

Back to: All Forums  The dRuby Book
27 Mar 2012, 09:13
Zeno Davatz (4 posts)


Can you please make an example of what you mean by the “calling ruby Thread” on page 169.

bq. The truth is that it is only the calling Ruby thread that gets blocked during the long system calls, and other Ruby threads will run without any problems.

Thanks! Great book!

27 Mar 2012, 21:57
Makoto Inoue (9 posts)

Hi, Thank you for your comment.

I may not have translated properly. What I meant by in this sentence is that one thread call does not block other threads if they are IO or system calls (not CPU related). That’s why the following “sleep” example takes 3 seconds to run 3 jobs each of which takes 3 seconds. If they block each other, it would have taken 9 seconds.

In other words, Ruby’s Thread can handle tasks in parallel as long as they are not CPU related. In this sense, it’s concurrency capability is similar to evented libraries (see, though evented can handle more connections.

Hope this explains a bit better.