Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There are three cooperating processes. They all read data from the same input de

ID: 3735873 • Letter: T

Question

There are three cooperating processes. They all read data from the same input device. Each process, when it gets the input device, must read two consecutive data, only one process may access the input device at a time (Hint: use mutual exclusion to achieve it). Use semaphores to synchronize. Include declaration and initialization 8. input (bl, b2) X= a2 + c1 + W input (cl, c2) W=a1+c2 + Y P1:input (al, a2) P2: P3: Print W Print Z 9. Consider the following snapshot of a system. (Show all work), Fill in the number of instances for each resource, the Need Matrix, and the minimum value of X RO has insta R1 has R2 has a minimum of R3 has instances R4 has instances, nces nstances, nstances Allocatiorn Max Need PAI 1 | 0 | 2 | 1 | 1 | 1 | 1 | 2 | 1 | 3 PB 2 02 2 2 1 PC0102 1 3 0 PD 1 101 RO RI R2 R3R41 Available What is the minimum value of X for a safe state?

Explanation / Answer

Solution:

The first question is done as per Chegg guidelines, please repost others.

8)

P1:
wait(mutex)
input (x1, x2)
C = y1 + x2 +z1
Print A
Print D
signal(mutex)

P2:
wait(mutex)
input (y1, y2)
B = x1 + z2 + A
D = B + C
signal(mutex)

P3:
wait(mutex)
input (z1, z2)
A = y2 + z1 + C
signal(mutex)

mutex is set to 1 at the start

when wait is requested from any of the processes, the others have to wait.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)