edited by
531 views

1 Answer

Best answer
4 votes
4 votes
Initial value of mutex, Q and R is 1, 1 and 1 respectively.

Suppose in computer() following instructions get execute

P(Mutex ) ----> Mutex = 0
P(Q)        -----> Q = 0
P(R)        ------> R = 0
V(Q)        -----> Q = 1

Suppose at this point Computer() get preempted by Science(), the following instructions executed in Science ()

P(Q)  -----> Q = 0
P(R)  -----> R = -1, so unsuccessful down operation, Therefore Science() cannot progress from here and wait for an V(R)

Again after sometime, Suppose Science() is preempted by Computer(), and starts to execute its remaining code...

V(mutex) ----> mutex = 1
P(Q)      -----> Q = -1, so unsuccessful down operation, Therefore Computer() cannot progress from here, and wait for V(Q)

Now the situation is Science() cannot progress and similarly Computer() is not been able to progress. And there is no possibility we are going to execute V(R) and V(Q) in near future, so Deadlock is present here, and because of this deadlock, startvation is going to happen.

Option C both deadlock and starvation is correct here.
selected by

Related questions

0 votes
0 votes
0 answers
1
Hopealways asked Dec 1, 2018
421 views
In these type of questions “Will we NOT consider CONTEXT SWITCHING unless mentioned???”If context switching is ALLOWED, minimum value will be 8...Correct me if I’m ...