answersLogoWhite

0


Best Answer

The wait and signal operations on condition variables in a monitor are similar to P and Voperations on counting semaphores. A wait statement can block a process's execution, while a signal statement can cause another process to be unblocked. However, there are some differences between them. When a process executes a Poperation, it does not necessarily block that process because the counting semaphore may be greater than zero. In contrast, when a wait statement is executed, it always blocks the process. When a task executes a V operation on a semaphore, it either unblocks a task waiting on that semaphore or increments the semaphore counter if there is no task to unlock. On the other hand, if a process executes a signal statement when there is no other process to unblock, there is no effect on the condition variable. Another difference between semaphores and monitors is that users awaken by a V operation can resume execution without delay. Contrarily, users awaken by a signaloperation are restarted only when the monitor is unlocked. In addition, a monitor solution is more structured than the one with semaphores because the data and procedures are encapsulated in a single module and that the mutual exclusion is provided automatically by the implementation.

(excerpted from http://ei.cs.vt.edu/~cs5204/sp99/monitor.html) The wait and signal operations on condition variables in a monitor are similar to P and V operations on counting semaphores. A wait statement can block a process's execution, while a signal statement can cause another process to be unblocked. However, there are some differences between them. When a process executes a P operation, it does not necessarily block that process because the counting semaphore may be greater than zero. In contrast, when a wait statement is executed, it always blocks the process. When a task executes a V operation on a semaphore, it either unblocks a task waiting on that semaphore or increments the semaphore counter if there is no task to unlock. On the other hand, if a process executes a signal statement when there is no other process to unblock, there is no effect on the condition variable. Another difference between semaphores and monitors is that users awaken by a V operation can resume execution without delay. Contrarily, users awaken by a signal operation are restarted only when the monitor is unlocked. In addition, a monitor solution is more structured than the one with semaphores because the data and procedures are encapsulated in a single module and that the mutual exclusion is provided automatically by the implementation.

(excerpted from http://ei.cs.vt.edu/~cs5204/sp99/monitor.html)

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

:) :)

The wait and signal operations on condition variables in a monitor are similar to P and Voperations on counting semaphores. A wait statement can block a process's execution, while a signal statement can cause another process to be unblocked.

Both provide mutual exclusion.

Monitors and Semaphores, both are used to solve the synchronization problems

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the similarity between semaphore and monitor?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which is a high level abstraction over semaphore?

Monitor


Construct a sentence using the word similarity?

There is a similarity between the theories.The twins had just one similarity.


What are the similarity between aim and objective?

what are the similarity between aim objective


What is difference between counting and binary semaphore in os?

Binary semaphore is a semaphore with the integer value ranges over 0 and 1 whereas the counting semaphore's integer value ranges over unrestricted domain. Binary semaphores are easier to implement comparing with the counting semaphore. Binary semaphore allows only one thread to access the resource at a time. But counting semaphore allows N accesses at a time. The 2 operations that are defined for binary semaphores are take and release. The 2 operations that are defined for counting semaphores are wait and signal


What is the similarity between a towel and tissues?

the similarity is: they both absorb water!


Similarity between philosophy and science?

Similarity is investigation in both the fields


What is the similarity between an entrance and an exit?

The similarity is that they r both doors.Good answer?


How many semaphore flag methods are there?

there are 28 semaphore flag methods.


What is one similarity and difference between the Sahel and savanna?

A similarity between a Sahel and the savannah is it gets rainfall :)


When was Semaphore - album - created?

Semaphore - album - was created on 1998-03-16.


When did Semaphore railway line end?

Semaphore railway line ended in 1978.


When was Semaphore railway line created?

Semaphore railway line was created in 1882.