13.3. ConclusionAs we've seen here, Ruby has so-called green threads (not native threads). These do not benefit from having multiple processors in a machine, but they can still be used for some level of concurrency. Threads can be a useful technique in many circumstances, but they can be somewhat problematic to code and debug. This is particularly true when we use sophisticated synchronization methods to achieve correct results. Ruby provides classes such as Mutex, Monitor, and ConditionVariable to aid in synchronization. It also provides the built-in Queue and SizedQueue classes, which are thread-safe. In Chapter 14, "Scripting and System Administration," we move away from a discussion of programming technique in itself to a more task-oriented topic. We'll be discussing the use of Ruby for everyday scripting and system administration tasks. |