Skip to content
Official PYQ · 2010

GATE CS 2010 Q23 — Concurrency and Synchronization

Explain with AI

Consider the methods used by processes P1P1 and P2P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1S1 and S2S2 are randomly assigned.
Method used by P1Method used by P2while (S1 == S2);while (S1 != S2);Critical SectionCritical SectionS1 = S2;S2 = not(S1);\begin{array}{|l|l|}\hline \textbf{Method used by P1} & \textbf{Method used by P2} \\ \hline \text{while (S1 == S2);} & \text{while (S1 != S2);} \\ \text{Critical Section} & \text{Critical Section} \\ \text{S1 = S2;} & \text{S2 = not(S1);} \\ \hline \end{array}
Which one of the following statements describes the properties achieved?

Choose one option
View worked solution

Answer: A

To determine which properties are satisfied, let us analyze Mutual Exclusion and Progress individually.

1. Mutual Exclusion

For a process to enter its Critical Section (CS), it must bypass its respective while loop condition:

  • For P1P1 to enter CS, the condition S1 == S2 must be false, which means S1≠S2S1 \neq S2.
  • For P2P2 to enter CS, the condition S1 != S2 must be false, which means S1==S2S1 == S2.

Since S1≠S2S1 \neq S2 and S1==S2S1 == S2 cannot be true simultaneously, both processes can never be in their critical sections at the same time. Thus, Mutual Exclusion is satisfied.

2. Progress

The progress requirement states that if no process is in its critical section and some processes want to enter, then only those processes not in their remainder section can participate in deciding which process enters next, and this decision cannot be postponed indefinitely.

Let us test this with an scenario:

  • Suppose the initial values are S1=trueS1 = \text{true} and S2=trueS2 = \text{true}.
  • Process P1P1 wants to enter its critical section. It tests the condition S1 == S2, which evaluates to true == true (true). Thus, P1P1 gets blocked in the while loop.
  • If process P2P2 is currently in its remainder section and has no interest in entering its critical section, it will not execute its code.
  • Since P2P2 is inactive, the values of S1S1 and S2S2 remain unchanged. Consequently, P1P1 is blocked indefinitely by a process (P2P2) that is not even competing for the critical section.

Since an uninterested process can block another process from entering the critical section, Progress is not satisfied.

Conclusion

The system achieves Mutual exclusion but not progress, which corresponds to option A.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Concurrency and Synchronization questions