GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 75(b)

Starvation analysis with retained timestamps

Operating Systems · Deadlocks · Full GATE CSE 1997 paper

GATE 1997, Q75(b) 2 marks · Descriptive
Report issue

Deadlocks

Question 75(b), GATE 1997: Each process receives a unique timestamp when it starts, increasing with time; smaller means older. On requesting a resource: if it is free, the OS grants it; if holder Q is older than requester P (TS(Q)<TS(P)), P waits; if Q is younger (TS(Q)>TS(P)), the OS restarts Q and grants the resource to P. Restarting takes back all Q's resources, kills Q, and starts it again with the same timestamp. When a resource is released, the waiting process with smallest timestamp receives it. A process asks for resources, uses them for some time, then exits. Can a process be starved? Prove or qualify your answer.
Question 75(b), GATE 1997: Each process receives a unique timestamp when it starts, increasing with time; smaller means older. On requesting a resource: if it is free, the OS grants it; if holder Q is older than requester P (TS(Q)<TS(P)), P waits; if Q is younger (TS(Q)>TS(P)), the OS restarts Q and grants the resource to P. Restarting takes back all Q's resources, kills Q, and starts it again with the same timestamp. When a resource is released, the waiting process with smallest timestamp receives it. A process asks for resources, uses them for some time, then exits. Can a process be starved? Prove or qualify your answer.
Tap to enlarge
Answer & solution

Answer: No protocol-induced starvation under finite older predecessors, finite terminating work, and fair execution; an unconditional guarantee without these progress assumptions is not justified. (no official key was published)

Fix a process P. When it begins there are only finitely many older processes in the usual finite-system model, and every later arrival has a larger timestamp. Because a restarted process keeps its original timestamp, repeated restarts do not move P behind newcomers. Only processes older than P can wound it or outrank it on a waiting queue.

First consider the oldest active process. It cannot be wounded, and it cannot be forced to wait for a younger holder: it wounds that holder and obtains the resource. Under fair CPU execution and the stated assumption that a process does finite work and exits, this oldest process eventually completes and releases its resources. Apply the same argument successively to the remaining older processes. Since P has finitely many older predecessors, eventually they have all completed.

P is then the oldest remaining process. New arrivals remain younger and cannot wound P. A resource held by a younger process is obtained by wounding that holder; if P is already waiting when a resource is released, smallest-timestamp selection gives it precedence over younger waiters. With finite resource requests/work and fair execution, P therefore finishes. This proves absence of starvation caused by the allocation protocol under the usual progress assumptions.

Retaining timestamps is crucial. Assigning a fresh, ever-larger timestamp after every restart would destroy the fixed finite-predecessor argument. Conversely, deadlock freedom by itself would not prove starvation freedom: an acyclic system could still repeatedly favor newcomers under a different queue rule.

The question's finite-use-and-exit wording motivates the normal no-starvation answer, but scheduler fairness is not explicitly specified. If the CPU never schedules P, or an older process never finishes, P may wait indefinitely despite the timestamp rules. Those countermodels violate the progress assumptions used in the proof; they do not exhibit a starvation defect in wound-wait itself. State the assumptions rather than claiming unconditional termination from timestamp ordering alone.

Original paper, page 12