recategorized by
13,488 views
52 votes
52 votes

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 $P_h$ be the process holding a resource $R, P_r$ be a process requesting for the same resource $R,$ and $T(P_h)$ and $T(P_r)$ 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?

  1. The scheme is deadlock-free, but not starvation-free
  2. The scheme is not deadlock-free, but starvation-free
  3. The scheme is neither deadlock-free nor starvation-free
  4. The scheme is both deadlock-free and starvation-free
recategorized by

6 Answers

0 votes
0 votes
Pls see if I am thinking right or wrong

If resource Is with process Ph and requesting process is Pr then what we can conclude is that definitely Ph would have came first than Pr than only Ph would have got the resource it means that timestamp of Ph would be less than Pr (say Ph came at 2 pm and Pr at 3p

m).Now since Pr is not killed by IF condition it goes in wait state and it is clearly it is mentioned that it will start at same time stamp than again it will have greater time stamp than Ph this will continue infintenly There this solution is not starvation free but deadlock free
0 votes
0 votes
Why no deadlock? Higher timestamp process gets preference. So there is order in which resources are allocated. So no circular wait hence no deadlock possible.

Why there is starvation? "restarted with the same timestamp if killed". So it cannot get ahead in race as it will be started with same TS.

So A is correct.
Answer:

Related questions

28 votes
28 votes
4 answers
8