An operating system handles requests for resources as follows. A process asks…

PYQ GATE 1997

An operating system handles requests for resources as follows.

A process asks for some resources, uses them for some time, and then exits the system. It is assigned a unique timestamp when it starts. Timestamps increase monotonically with time. Let TS(P) denote the timestamp of process P.

When process P requests a resource, the operating system applies these rules:

(i) If no other process currently holds the resource, it awards the resource to P.

(ii) If a process Q with TS(Q) < TS(P) holds the resource, P waits for the resource.

(iii) If a process Q with TS(Q) > TS(P) holds the resource, the operating system restarts Q and awards the resource to P. Restarting takes back Q’s resources, kills Q, and starts it again with the same timestamp.

When a process releases a resource, the waiting process with the smallest timestamp, if any, is awarded the resource.

(a) Can a deadlock ever arise? If yes, show how. If not, prove it.

(b) Can a process P ever starve? If yes, show how. If not, prove it.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…