Why Is Ruby Multithreading Slow?

30-Apr-2017 2954
And I decided to run it with ruby 't.rb' instead of from within irb. Of course, I didn’t get what I expected — I got no output at all, and my program exited immediately. It didn’t take me long to figure out the problem — the main thread exiting before the other threads ever got the processor — or to fix it by adding [producer, printer1, printer2].each { |t| t.join } to the end of the script.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle