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

asked in Operating System by Active (4.6k points) | 133 views

1 Answer

+1 vote
Best answer
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.
answered by Loyal (7.7k points)
selected by

Related questions

+1 vote
1 answer
0 votes
1 answer

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

44,073 questions
49,595 answers
65,791 users