IT lexicon › Programming › Monitor pattern

Monitor pattern

Programming På svenska → Updated: 2026-11-15

A high-level synchronization pattern where locking and condition variables are embedded in a class to guard shared state.

The monitor pattern abstracts away locking details—all critical sections are in a method, locks are acquired automatically, and condition variables wait and signal without explicit lock management. It's the classical model used in languages like Concurrent Pascal and appears often in modern object-oriented code. The design makes correctness easier but can amplify lock contention if many threads compete for the same monitor. Java's synchronized keyword and the monitor-based frameworks in C++ (mutexes plus condition variables) follow this pattern.

← Back to the lexicon