Chapter 13. Threads and Concurrency

He draweth out the thread of his argument finer than the staple of his verbosity.

—William Shakespeare,Love’s Labours Lost, Act V, Sc. 1

One of the wonders of modern computers is that they appear to be able to do more than one thing at a time. Even back in the days of single-core processes, the lone CPU could switch between its various jobs quickly enough that it appeared to be doing many things at once. With the advent of inexpensive computers with multiple CPUs, that illusion has become reality. Thus, we take it for granted that we can simultaneously download a gem while we surf the Internet and print a document. This concurrency is exposed to programmers in two fundamental forms: processes and threads. In ...

Get The Ruby Way: Solutions and Techniques in Ruby Programming, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.