Question: I am looking forward an answer for below question: 1. Let mySem be a semaphore and let P1, P2, P3 be three processes that use
I am looking forward an answer for below question:
1. Let mySem be a semaphore and let P1, P2, P3 be three processes that use the semaphore. For each of the three sequences of semaphore calls (acquire() to take the semaphore, release() to give up the semaphore), provide the following information for each call
for acquire() calls show the new value of count and indicate whether the calling process blocks on the semaphore or proceeds to its critical section
for release() calls show the new value of count and indicate whether a process is removed from the semaphore blocked queue (and if so which one)
show the semaphore queue for each call Assume the processes make the semaphore calls in the order given and that the semaphore count is initialized as specified.
| Initial semaphore count is 1 | Initial semaphore count is 2 | Initial semaphore count is 0 |
| P1: acquire() | P1: acquire() | P1: acquire() |
| P2: acquire() | P2: acquire() | P2: acquire() |
| P3: acquire() | P3: acquire() | P3: release() |
| P1: release() | P1: release() | P2: release() |
| P1: acquire() | P1: acquire() | P1: release() |
| P2: release() | P2: release() | P3: acquire() |
| P3: release() | P3: release() | P2: acquire() |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
