Overview

Synchronization Primitives are software abstractions built on top of hardware atomic instructions (or interrupt disabling) that allow concurrent threads to safely access shared resources, enforce mutual exclusion, and coordinate execution timing.


Core Primitives

Primitive LinkDescriptionPrimary Mechanism / APIPrimary Use CaseLevelMutual ExclusionEvent CoordinationLock ManagementPrimary Limitation
LocksEnforces strict mutual exclusion across critical sections. Evolves from hardware spinlocks to guarded sleep locks.acquire(), release(), test_and_set()Mutual Exclusion (Single Thread in Critical Section)Low-LevelYesNoManual (acquire/release)Prone to missing release() calls
SemaphoresDijkstra’s non-negative integer variable. Retains event history to manage resource pools and timing sequences.wait() (), signal() (), Counter + Wait QueueMutual Exclusion () AND Event Sequencing ()Mid-LevelYes (Binary)Yes (Counting)Manual (wait/signal)Unstructured; history counter can confuse state logic
Condition VariablesMemoryless synchronization queues allowing threads to sleep inside critical sections by atomically releasing locks.wait(), signal(), broadcast() (Mesa Semantics)Waiting for complex shared state conditionsMid-LevelNoYesManual (Paired with Lock)Memoryless; must re-check conditions in while loop
MonitorsLanguage-level constructs encapsulating shared data and routines with compiler-enforced implicit mutual exclusion and internal CVs.Encapsulated Procedures + Implicit Locks + Internal CVsStructured, language-supported thread synchronizationHigh-LevelYes (Implicit)Yes (Via internal CVs)Automatic (Compiler)Requires language/runtime support (e.g., Java synchronized)

Related Modules