operating-systems concurrency

Definition

Condition Synchronisation

Condition synchronisation is a concurrency control mechanism used to ensure a specific execution order between multiple processes or threads. It allows a process to delay its execution until a specific logical condition or event (triggered by another process) is met.

Unlike mutual exclusion, which focuses on preventing simultaneous access to data to maintain consistency, condition synchronisation focuses on the coordination of action sequences to avoid race conditions.

Comparison with Mutual Exclusion

Mutual exclusion and condition synchronisation are orthogonal concepts that can be used independently or together:

GoalMutual ExclusionCondition Synchronisation
Primary PurposeData ConsistencyExecution Ordering
Logic”Only one at a time""Wait until event X occurs”
ConstraintNo overlapping accessDefined action sequence

Mechanism

A common requirement for condition synchronisation is that an action in process must finish before an action in process can begin. This can be implemented using a semaphore initialised to 0:

  • Process : Executes , then calls signal(S).
  • Process : Calls wait(S), then executes .

Implementation Tools

Operating systems provide several constructs to facilitate condition synchronisation: