Chapter 22
Synchronization
Thread cooperation requires coordination, typically via synchronization. Waiting for a thread or a thread pool to terminate is an example of such synchronization. More generally, different types of synchronizers can be used to block one or more threads until the state of an application allows them to make progress. When misused, synchronization that unnecessarily blocks threads may cause a program to slow down, or even to come to a halt in the case of a deadlock. Snapshots of the states of threads—whether they are blocked, and on which synchronizer—can be used to debug these situations. Synchronization is also leveraged by runtime systems to optimize the memory usage of parallel tasks. These optimizations are specified ...
Get Functional and Concurrent Programming: Core Concepts and Features now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.