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

asked in Operating System by Boss (6k points) | 74 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 Boss (6.6k points)
selected by


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

29,167 questions
36,992 answers
92,225 comments
34,837 users