Skip to content
Related Articles

Related Articles

GATE | GATE-IT-2004 | Question 63

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jun, 2021

In a certain operating system, deadlock prevention is attempted using the following scheme. Each process is assigned a unique timestamp, and is restarted with the same timestamp if killed. Let Ph be the process holding a resource R, Pr be a process requesting for the same resource R, and T(Ph) and T(Pr) be their timestamps respectively. The decision to wait or preempt one of the processes is based on the following algorithm.

 if T(Pr) < T(Ph)

     then kill Pr

else wait

Which one of the following is TRUE?

(A) The scheme is deadlock-free, but not starvation-free
(B) The scheme is not deadlock-free, but starvation-free
(C) The scheme is neither deadlock-free nor starvation-free
(D) The scheme is both deadlock-free and starvation-free


Answer: (A)

Explanation:  

  1. This scheme is making sure that the timestamp of requesting process is always lesser than holding process
  2. The process is restarted with same timestamp if killed and that timestamp can NOT be greater than the existing time stamp

From 1 and 2,it is clear that any new process coming having LESSER timestamp will be KILLED.So,NO DEADLOCK possible

However, a new process will lower timestamp may have to wait  infinitely because of its LOWER timestamp(as killed process will also have same timestamp ,as it was killed earlier).STARVATION IS Definitely POSSIBLE

So Answer is A

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!