The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes

  1. P1 terminates but P2 does not
  2. P2 terminates but P1 does not
  3. Both P1 and P2 terminate
  4. Neither P1 nor P2 terminate 
in Operating System by Active (2.7k points)
edited by | 105 views

2 Answers

+1 vote

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.

by (27 points)
0 votes
What is the answer??
by Junior (827 points)
C is the answer???
What is false not true asked in question right
B is the answer??
Why B answer can you explain
Yes they've given C as the answer. Can anyone explain?

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,896 questions
55,153 answers
85,317 users