Question: a) Modify the following code (using two semaphores) so that the two programs P and P2 execute alternatively (i.e., ...,P2P,PPP... with P, being the first

a) Modify the following code (using two semaphores) so that the two programs P and P2 execute alternatively (i.e., ...,P2P,PPP... with P, being the first to start execution. C2 Begin ParBegin P1, P2 ParEnd End Program Pa: Begin while (true) {1;} End Program Pz: Begin while (true) {C2;} End b) In the previous program, the two programs P, and P2 are executed in such a way fairness is guaranteed. Modify the previous program (using two semaphores) so that the execution order becomes ...,P2P,P2P,P2P,P .....) with P, being the first to start execution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
