Please Check the image and provide solution, thank you. In an operating system p
ID: 3550033 • Letter: P
Question
Please Check the image and provide solution, thank you.
In an operating system processes can run concurrently. Sometimes we need to impose a specific order in execution of a set of processes. We represent the execution order for a set of processes using a process execution diagram. An example process execution diagram is shown in Figure 2. In this graph, a process Pi (where i=1,2,3,4) is represented by a directed edge. The graph indicates that P3 can be run concurrently with P1 and P2, but P1 must terminate before P2 starts execution. Also, P4 can only be run after the other three processes have terminated. The flow graph can be described using semaphores in the following way: P1: body; signal(S1); P2: wait(S1); body; signal(S2); P3: body; signal(S3); P4: wait(S2); wait (S3); body; Semaphores are counting semaphores and all semaphores are initialized to 0. wait(Si) means that a process is waiting for semaphore Si to be set. Whenever a process i terminates, it will signal to the corresponding semaphore Si. We denote this by signal(Si). body means that the process is executed. Note: P4 only needs to wait for P2 and P3 to terminate, not for P1. Based of these explanations, use similar semaphores to describe the following graph (Figure 3).Explanation / Answer
P1: body;signal(S1);
P2:wait(S1);body;signal(S2);
P3:wait(S1);body;signal(S3);
P4;wait(S2);wait(S3);body;signal(S4);
P5:wait(S1);body;signal(S5);
P6:wait(S4);wait(S5);body;