Process Synchronization


  1. Abraham Silberschatz, Greg Gagne, and Peter Baer Galvin, "Operating System Concepts, Eighth Edition ", Chapter 6

Warning: This chapter requires some heavy thought. As you read each of the algorithms below, you need to satisfy yourself that they do indeed work under all conditions. Think about it, and don't just accept them at face value.

6.1 Background

Consumer code from chapter 3:

6.2 The Critical-Section Problem

6.3 Peterson's Solution

6.4 Synchronization Hardware

6.5 Semaphores

6.5.1 Usage

6.5.2 Implementation

6.5.3 Deadlocks and Starvation

6.5.4 Priority Inversion ( New )

6.6 Classic Problems of Synchronization

The following classic problems are used to test virtually every new proposed synchronization algorithm.

6.6.1 The Bounded-Buffer Problem

6.6.2 The Readers-Writers Problem

6.6.3 The Dining-Philosophers Problem

6.7 Monitors

6.7.1 Usage

Signal and wait - When process P issues the signal to wake up process Q, P then waits, either for Q to leave the monitor or on some other condition.

Signal and continue - When P issues the signal, Q waits, either for P to exit the monitor or for some other condition.

There are arguments for and against either choice. Concurrent Pascal offers a third alternative - The signal call causes the signaling process to immediately exit the monitor, so that the waiting process can then wake up and proceed.


6.7.2 Dining-Philosophers Solution Using Monitors

6.7.3 Implementing a Monitor Using Semaphores

6.7.4 Resuming Processes Within a Monitor

6.8 Synchronization Examples

This section looks at how synchronization is handled in a number of different systems.

6.8.1 Synchronization in Solaris

Adaptive Mutexes

Reader-Writer Locks


6.8.2 Synchronization in Windows XP

6.8.3 Synchronization in Linux

6.8.4 Synchronization in Pthreads

6.9 Atomic Transactions

6.9.1 System Model

6.9.2 Log-Based Recovery

6.9.3 Checkpoints

6.9.4 Concurrent Atomic Transactions Serializability Locking Protocol Timestamp-Based Protocols

6.10 Summary