Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned. Method used by PI Method used by P2 While (S1 == S2); Critical Section S1 = S2; While (S1 != S2); Critical Section S2 = not (S1); Which one of the following statements describes the properties achieved?
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned. Method used by PI Method used by P2 While (S1 == S2); Critical Section S1 = S2; While (S1 != S2); Critical Section S2 = not (S1); Which one of the following statements describes the properties achieved? Correct Answer Mutual exclusion but not progress
Key PointsThe given mechanism is based on strict alternation, which guarantees always mutual exclusion and never progress.
In this mutual exclusion is satisfied because at any point of time either S1=S2 or S1 != S2, but not both. But here progress is not satisfied because suppose S1=1 and S2=0 and P1 is not interested to enter into the critical section but P2 wants to enter into the critical section, and P2 will not be able to enter, because until P1 will not enter the critical section, S1 will not become equal to S2. So if one process is not interested in entering the critical section, it will not allow the other process to enter the critical section which is interested. So progress is not satisfied.
Hence the correct answer is Mutual exclusion but not progress.