• edited by
921 views

1 Answer

Best answer
4 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
Position:
Show:

Related questions

0 0 votes
0 0 answers
822
822 views
Hopealways asked Dec 1, 2018
822 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 wrong.
0 0 votes
0 0 answers
854
854 views
Tuhin Dutta asked Oct 2, 2017
854 views
The pic shows the question along with options:
4 4 votes
1 answers 1 answer
1.7k
1.7k views
Pankaj Joshi asked Feb 1, 2017
1,684 views
Consider the following code used by the classical readers and writers.Note: rc = rc+1; will execute in 3 instructions like load, increment and then store.Which of the bel...