Process Synchronization 12/03/15 Taken largely from: http://www.studytonight.com/operating-system/process-synchronization
Process Synchronization? Process Synchronization means sharing system resources by processes in a such a way that concurrent access to shared data is handled, thereby minimizing the chance of inconsistent data. Maintaining data consistency demands mechanisms to ensure synchronized execution of cooperating processes. Process Synchronization was introduced to handle problems that arose while multiple process are in execution.
Critical Section Code segment accessing shared variables Executed as an atomic action Multiple “cooperating” processes Only one process in critical section at a time
Critical Section Code
Critical Section Solution Must Provide Mutual Exclusion – one at a time Progress – if critical section available and processes waiting for it, one must get it Bounded Waiting – must be a limit on how long process must wait
Implementing Critical Section Hardware – difficult and expensive Software Mutex lock (see diagram above) Semaphore Wait – P Signal – V Binary Semaphore (mutex) or Counting Semaphore (bounded concurrency)
Classical Synchronization Problems Lots of these in OS literature, including Producer - Consumer Reader - Writer Dining Philosophers