Managing shared data

All threads in a process have access to the same global memory, so the results of computations performed in one thread are relatively easy to share with other threads. Concurrent read-only operations on shared memory do not require any coordination, but any write to shared memory requires synchronization with any read or write. Threads that share mutable data and other resources need mechanisms to arbitrate access to shared data and signal each other about events and state changes. In this section, we explore the mechanisms for coordination between multiple threads.

Creating and coordinating concurrent tasks

Consider a program that generates the difference between two text files à la the Unix diff utility. You need to read two ...

Get Learning Boost C++ Libraries 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.