Question: Consider a version of the bounded buffer problem in which there are two producer process (P 1 and P 2 ) and one consumer processes
Consider a version of the bounded buffer problem in which there are two producer process (P1 and P2) and one consumer processes (P3) all sharing the same buffer. Assume that the size of the buffer is n = 4, and that we start with a completely empty buffer. The structure of P1, P2, and P3 as well as the semaphores and buffer is shown below:

Assume a preemptive scheduler and that all processes start in the ready queue at the same time in the order from head to tail, P3, P2, and P1 (P3 at the head of the queue). Let the process priorities be: P3 = 1, P2 = 2, and P1 = 2.
Draw the contents of the indices in and out, as well as the state of the semaphores, the ready queue and the contents of the buffer after 2 items have been consumed. In the case of the buffers, simply notate each item with the name of the process that accessed it last.
of P3 of do do wait (full) produce an item in nextp wait tex next buffer out) wait empty. out (out 1 Sn signal trutex) wait utex) signal empty. buffer i nextp in tin 1 n terri signal rutex) n next signal fu. tem 0 tem 1 tem 2 tem 3 out 4 pty 0 full mutex
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
