edited by
1,483 views

3 Answers

5 votes
5 votes

P1, checking condition and increment value of x atomically. Now x=1 and before checking condition again its preempted.

Now P2 come in focus and checking condition and increment value of y and set value of z atomically. Now y=2 and z=true and before checking condition again its preempted.

Now P1 comes in focus and check while condition again and its true.

therefore both process never terminated.this is true statement. therefore option (D) true.

Now assume that process P2 terminate then process P1 while condition become false because according to P2, it will terminate when while statement false means z = false, and z value will set false when x==y.

Therefore due to P2 P1 also terminate.Now option (c) is also true.

Now when we execute normally then P1 execute first and second time its while condition false and its terminate. but for P2 it doesn't terminate it always increase value of y and set z = true.

Therefore option (A) also true.

But question asked what is false condition, So remaining option is option (B). It means option (B) is false.

therefore option (B) is correct answer.

0 votes
0 votes
What is the answer??
0 votes
0 votes
Let all the initializations be there.

Suppose while entering P1, before its while condition we prempt to P2. Now the while loop runs forever after executing as it says while(z) and z=1 always. So P2 never ends resulting in P1 also not stopping. Hence option C is correct answer.

Related questions