What is a Monitor In Interprocessing Communication ?It is a programming language construct that controls access to shared data. or
Monitor is a module that encapsulates
- Shared Data Structure.
- 'Procedures' that operate on the share data structure
- Synchronization between concurrent procedure invocations.
monitor is same as a class type: Like object of class are created, the variable of monitor type are defined.
Critical regions are written as procedures and encapsulated together in a single module.
The synchronization among the process is provided through the monitor entry procedure.
***Wait and signal introduced in semaphores are also implemented in monitor through the use of 'condition' variables.
Condition variable are different from normal variable because each of them has an associated queue.
Process Calling wait on a particular condition is put into the queue associated with the condition variable.
It means that process is waiting to enter a CS guarded by the monitor.
A process calling the signal causes the waiting process in the queue to enter the monitor. These all variables are declared as:
Condition < name of variable >
wait< condition variable>
signal < condition variable >
To force a process to exit immediately after the signal operation, signal-to-exit monitor is used. If a process needs to be inside the monitor for some more time after signalling, then signal-and-continue monitor in used. It means that the signalling has been done by the process, but it still maintains a lock on the semaphore.
Java programming language implement the signal-and- continue monitor.