Monitors examples process synchronization role procedures shared data Operating Systems (OS)

Monitors examples in process synchronization in Operating Systems (OS)

In this tutorial, we will try to learn the followings;

  1. What is a monitor in operating systems?
  2. What are Shared data variables?
  3. Example of monitor
  4. What is the role of the monitor in-process synchronization?

What are procedures(operations)?

A monitor is an abstract data type that is used for synchronizing the processes.

A monitor contains the shared data variables and procedures(operations).

What are Shared data variables?

Shared data variables are shared by all the processes.

What are procedures(operations)?

Procedures(operations) allow processes to execute in mutual exclusion within the monitor. A process can only get the access to shared data variables in the monitor if procedures in the monitors allow the process. Monitors take care of all synchronization among processes.

Is it possible that a process directly accesses the shared data variable in the monitor?

No, it is not possible. A process can not directly access the shared data variable in the monitor. Accessing of shared data is controlled by procedures in the monitor.

monitors process synchronization operating systems OS
Figure: Monitors process synchronization operating systems OS.

Example of monitor

What is the role of the monitor?

Procedures in the monitors help the operating systems to synchronize the processes.