Consider the methods used by processes P1 and P2 to access their critical…
2010
Consider the methods used by processes P1 and P2 to access their critical sections whenever needed. The initial values of the shared Boolean variables S1 and S2 are assigned arbitrarily.
Method used by P1 | Method used by P2 |
|---|---|
| |
Which statement describes the properties achieved by these methods?
Answer: A. Mutual exclusion but not progress — ConceptMutual exclusion requires that at most one process be inside its critical section at any instant. Progress requires that, when the critical section is…
- A.
Mutual exclusion but not progress
- B.
Progress but not mutual exclusion
- C.
Neither mutual exclusion nor progress
- D.
Both mutual exclusion and progress
Attempted by 47 students.
Show answer & explanation
Correct answer: A
Concept
Mutual exclusion requires that at most one process be inside its critical section at any instant. Progress requires that, when the critical section is free and some process wants to enter, the choice of the next entrant cannot be delayed indefinitely by a process that is not interested.
A busy-wait guard allows a process to enter only when its condition becomes false. If two guards depend on complementary Boolean states, they can enforce alternation, but strict alternation can violate progress.
Application
P1 waits while S1 equals S2, so P1 can pass its guard only when S1 and S2 are unequal. P2 waits while S1 differs from S2, so P2 can pass its guard only when S1 and S2 are equal.
Equality and inequality cannot hold simultaneously. Therefore, while one process is permitted to enter, the other process remains blocked; simultaneous entry is prevented.
After P1 leaves its critical section, S1 = S2 makes the variables equal and enables P2. After P2 leaves, S2 = not(S1) makes them unequal and enables P1.
This forces strict alternation. If the process whose turn is enabled does not want to enter, it never executes its exit assignment, so the other interested process can wait forever even though the critical section is free.
Cross-check
For an equal state, only P2 can pass; after P2 sets S2 to not(S1), only P1 can pass. Reversing the starting state reverses the first turn but preserves the same alternation.
Thus the methods guarantee mutual exclusion but fail the progress requirement.