305 views
1 votes
1 votes

Consider the following Pseudo code:
Process A is :
begin
loop

Non_critical_section;
while not (Turn=1) do
       skip
End while;
       Critical_section_1;
        Turn=2;
   end loop
end
Process B is  
begin
   loop
    Non_critical_section;
    while not (turn=2) do
       skip
End while;
    Critical_section_2;
    Turn=1
   end loop
End

Which of the following statements is/are true? (Assume initially turn =1)

  1.   No Mutual exclusion
  2.   Mutual exclusion guaranteed, but deadlock will arise.
  3.  Mutual exclusion guaranteed, deadlock free, but suffers from starvation.

1 Answer

2 votes
2 votes
Process A will enter in its critical section only when turn is equal to one and if process B wants to enter in its critical section its will not enter as turn is one intially (assumed).

So mutual exclusion is there.

But if turn is one intially then process B cannot enter in critical section evenif process A does not want to go in its critical section.so progress is not in there.

So starvation arise but deadlock not .

No related questions found