Question: Consider the following code for three cooperating processes, which are executing concurrently and write the output. Semaphore A = 0, B = 0; // where

Consider the following code for three cooperating processes, which are executing concurrently and write the output. Semaphore A = 0, B = 0; // where A and B are binary semaphores pid=2, Process P2 pid=3, Process P: pid=1, Process P void main() { int pid = 1; wait (B); printf("ProcessID=%d", pid); void main() { int pid = 2; printf("Process ID=%d", pid); signal (A); void main() { int pid = 3; wait (A) printf("ProcessID=%d", pid); signal (B); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
