Similar questions 1 more →
Synchronization & Concurrency

Answer & solution
Answer: A (no official key was published)
P1 passes its guard only when S1≠S2; P2 passes only when S1=S2. Neither changes the shared state until leaving its critical section, so while one is inside the other’s guard stays blocking: mutual exclusion holds. Progress fails: if S1=S2 and only P1 wants to enter, P1 spins forever unless P2 participates and changes S2. The symmetric case also occurs. This is strict alternation, so A, assuming atomic sequentially consistent accesses as the pseudocode model does.
After P1 exits it sets S1=S2, making P2 eligible and itself ineligible; after P2 exits it makes S2 the opposite of S1, restoring P1’s turn. Consequently the processes alternate even if one no longer wants the critical section. Mutual exclusion is a safety property; progress additionally requires that an uninterested process not prevent an interested one from entering.