Chapter 4. Shared-Memory Programming with Pthreads
Recall that from a programmer's point of view a shared-memory system is one in which all the cores can access all the memory locations (see Figure 4.1 . Thus, an obvious approach to the problem of coordinating the work of the cores is to specify that certain memory locations are “shared.” This is a very natural approach to parallel programming. Indeed, we might well wonder why all parallel programs don't use this shared-memory approach. However, we'll see in this chapter that there are problems in programming shared-memory systems, problems that are often different from the problems encountered in distributed-memory programming.
For example, in Chapter 2 we ...