• edited by
2,865 views

3 Answers

5 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 0 votes
What is the answer??
0 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.
Position:
Show:

Related questions

1 1 vote
2 2 answers
3.2k
3.2k views
Pankaj Joshi asked Jan 23, 2017
3,207 views
Consider the following ‘C’ codeAssume P1 and P2 are two concurrent processes and sharing the global variables x, y and z. Assignmentsand tests are atomic. Consider the fo...
4 4 votes
0 0 answers
1.7k
1.7k views
atulcse asked Jan 19, 2022
1,701 views
Consider the following proposed solution to Dining Philosopher’s problem to avoid deadlock. The binary semaphore lock is initialized to 1.Which of the following is correc...
1 1 vote
0 0 answers
1.5k
1.5k views
MiNiPanda asked Jan 1, 2019
1,483 views
Consider the following 2 functions P and Q which share 2 common variables A and B:P() Q() { { A=A+5; A=B+6; B=A-3; B=A-2; } }If P and Q execute concurrently, the initial ...
0 0 votes
1 1 answer
944
944 views
Gokulnath asked Dec 21, 2018
944 views
The definition of progress is: “When no process is in the critical section and another process wants to enter the critical section, then it should be allowed without any ...