operating-systems concurrency

Definition

Monitor

A monitor is a high-level synchronisation construct encapsulating data, procedures, and initialisation code into a single module, providing automatic mutual exclusion. Unlike semaphores, only one process can be active within its boundaries at any time.

Properties

Internal Data Protection

Local variables can only be accessed by the monitor’s own procedures.

Entry Queue

If another process is active in the monitor, the caller is suspended in an entry queue.

Synchronisation

Uses condition variables to handle waiting for specific states (e.g., buffer non-empty).

Queues

Entrance Queue

Processes waiting to enter the monitor.

Urgent Queue

Processes deblocked by csignal waiting to resume. Given higher priority than Entrance Queue.

Condition Queues

One queue per condition variable , containing processes suspended by cwait(c).

Properties

Robustness

Mutual exclusion handled by structure, less prone to errors than semaphores.

Clarity

Synchronisation logic centralised within the module rather than scattered across processes.