According to the definition of a monitor originated by H.A.R Hoare, only one pro
ID: 3734254 • Letter: A
Question
According to the definition of a monitor originated by H.A.R Hoare, only one process can be active in a monitor at one time. Compare the interpretation of this requirement in the Stallings text and in Silberschatz: which of them appears to allow that multiple processes can be admitted to the monitor, but that all but one of them is waiting on some condition; which of them suggests that when a process blocks on a condition, it is placed back on the entry queue, so there is only one process in the monitor at one time? What exception does Stallings seem to make to this rule, and how does he implement it?
Explanation / Answer
Monitors explained by Silberschatz
All processes share a variable called mutex which is initialized to 1 and all process who wants to enter critical section enters by executing wait(mutex) and while leaving critical section it executes signal(mutex). A monitor type is an ADT that includes set of programmer defined operations that ensures mutual exclusion within the monitor. Here the monitor will ensure that only one process is executing in CS so the programmer need not program the synchronization explicity. To do this condition is used.
condition x,y;
Only wait() and signal() operations can invoke condition variable. The process invoking x.wait() is suspended until another process invokes x.signal(); The x.signal() operation resumes exactly one suspended process. If no process is suspended, then the signal() operation has no effect; that is, the state of x is the same as if the operation had never been executed. Suppose x.signal() operation is invoked by a process P, there exists a suspended process Q associated with condition x. This makes the signaling process P to wait.
Two possibilities exist:
1. Signal and wait. P either waits until Q leaves the monitor or waits for another condition.
2. Signal and continue. Q either waits until P leaves the monitor or waits for another condition.
This ensures that only one process is inside critical section.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.