In this post, we will understand the difference between semaphore and monitor in an operating system −
It is an integer variable.
The value of this integer variable tells about the number of shared resources that are available in the system.
When any process has access to the shared resources, it performs the ‘wait’ operation (using wait method) on the semaphore.
When a process releases the shared resources, it performs the ‘signal’ operation (using signal method) on the semaphore.
It doesn’t have condition variables.
It is an abstract data type.
It contains shared variables.
It also contains a set of procedures that operate upon the shared variable.
When a process wishes to access the shared variables in the monitor, it has to do so using procedures.
It has condition variables.