Monitors - aryanjoshi0823/5143-Operating-System GitHub Wiki
What Are Monitors?
A monitor is essentially a module that encapsulates a shared resource and provides access to that resource through a set of procedures. The key features of monitors include:
- Mutual Exclusion: Only one process can access the shared resource at any given time.
- Process Suspension: Processes waiting for the resource are suspended until it becomes available.
- Simplification: Provides a structured way of sharing data and synchronization information.
- Condition variables are used for process coordination within the monitor.
Key Advantages
- Simplifies Implementation: Monitors hide the complexity of synchronization.
- Encapsulation: Synchronization logic is encapsulated within the monitor, making it easier to reason about system correctness.
- High-Level Abstraction: Reduces the need for complex primitives like semaphores and locks.
Limitations
- Overhead: May be less efficient than lower-level synchronization primitives due to abstraction.
- Not Universally Applicable: Some synchronization problems may require lower-level primitives for optimal performance.