Question: 3. Consider two processes po, pland a shared variable int buffer [2] which takes only two 6 values 0 or 1. If value of
![3. Consider two processes po, pland a shared variable int buffer [2]](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/02/65d48a77a4a07_1708517826478.jpg)
3. Consider two processes po, pland a shared variable int buffer [2] which takes only two 6 values 0 or 1. If value of buffer [0] is 1 then p0 will enter into the critical section and p1 [1] is 1 then pl will enter into the critical section. Initially both values of buffer variable is zero. For the above scenario I have proposed a "solution to the critical- section problem. Determine its correctness. If it is incorrect then show an example that violates mutual exclusion and write the correct statement that can solve the problem. int turn=0; int flag[2]={0}: Process i{ } while (true){ } j = other process's ID; flag[i] = 1; while (flag[i]): turn = i: CRITICAL_SECTION flag[i] = 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
