GATE - 2004 | OS | In a certain operating system, deadlock prevention is attempted

GATE - 2004 | OS | In a certain operating system, deadlock prevention is attempted
Posted on 22-02-2022

GATE - 2004 [Operating System]

Question:

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

Solution:

Option (A) is Correct.

When the process washes up again after it has been killed once or twice, it will have same time stamp as it had when it was killed first time. And that time stamp can never be greater than a process that was killed after that or a new process that may have arrived. So, every time when the killed process washes up it might always find a new process that will say "your time stamp is less than me and I take this resource", which ofcourse is as we know, and that process will again be killed.
So, starvation is possible, but deadlock is not possible.

Thank You