Concurrency: Mutual Exclusion and Synchronization
Problems with concurrent execution
Framework for analysis of solutions
Requirements for a valid solution to the critical section problem
Requirements for a valid solution to the critical section problem
Algorithm 3 (Peterson’s algorithm)
Algorithm 3: proof of correctness
Algorithm 3: proof of correctness (cont.)
n-process solution: bakery algorithm
Drawbacks of software solutions
Hardware solutions: interrupt disabling
Hardware solutions: special machine instructions
The test-and-set instruction (cont.)
Using xchg for mutual exclusion
Semaphore’s operations (atomic)
Using semaphores for solving critical section problems
Using semaphores to synchronize processes
Solution of P/C: unbounded buffer
P/C: finite circular buffer of size k
P/C: finite circular buffer of size k
Solution of P/C: finite circular buffer of size k
The Dining Philosophers Problem
The Dining Philosophers Problem
The Dining Philosophers Problem
Monitor for the bounded P/C problem
Monitor for the bounded P/C problem
Synchronization in message passing
Synchronization in message passing
Ownership of ports and mailboxes
Enforcing mutual exclusion with message passing