Semaphore Problem Suppose, there are three producers P1, P2, and P3 who want to produce and put items in the buffer. And, there are four consumers C1, C2, C3, and C4 who want to consume items from the buffer. No process takes more than 5 units of time to complete unless the process goes to the waiting queue(S->list) of semaphore. At a certain point of the execution, following are the values of the semaphores: mutex=1 , countEmpty=8, countFull=2 Find the
Semaphore Problem
Suppose, there are three producers P1, P2, and P3 who want to produce and put items in the buffer. And, there are four consumers C1, C2, C3, and C4 who want to consume items from the buffer. No process takes more than 5 units of time to complete unless the process goes to the waiting queue(S->list) of semaphore.
At a certain point of the execution, following are the values of the semaphores:
mutex=1 , countEmpty=8, countFull=2
Find the output of the following sequence of commands.
At time 0 : C1 started
At time 0: C2 started
At time 10: C3 started
Value of countEmpty ?
Value of countFull ?
Processes in the waiting queue of the semaphore ?
[Write process names with Capital letter, For example: P7. If there are multiple process writes their names using comma, For example: P6,P7. If there is no process in the semaphore's list, write EMPTY in the box]
At time 15 : P1 started
At time 20 : P2 started
Value of countEmpty ?
Value of countFull ?
Processes in the waiting queue of the semaphore ?
At time 25 : C4 started
At time 30 : P3 started
Value of countEmpty ?
Value of countFull ?
Processes in the waiting queue of the semaphore ?
Step by step
Solved in 2 steps with 2 images