Last Updated : 06 Dec, 2018

Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given in statements. Which one of the following method(s) used by process P1 and P2 describes mutual exclusion and progress properties achieved?

S1: The initial values of shared Boolean variables S1 and S2 are randomly assigned:

Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2; 

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1); 

S2: The initial values of shared Boolean variables S1 and S2 are equally assigned:

Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2; 

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1); 

(A) Only S1
(B) Only S2
(C) Both S1 and S2
(D) Neither S1 not S2


Answer: (D)

Explanation: In both conditions, two process can not be in critical section at a time and either process can not enter into critical section in its first attempt.

So, Mutual exclusion is satisfied but progress is not satisfied for given either methods.

Option (D) is correct.

Quiz of this Question


Share your thoughts in the comments