Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1997 | Question 74

Improve Article
Save Article
  • Last Updated : 30 Oct, 2017
Improve Article
Save Article

An operating system handles requests to resources as follows.
A process (which asks for some resources, uses them for some time and then exits the system) is assigned a unique timestamp are when it starts. The timestamps are monotonically increasing with time. Let us denote the timestamp of a process P by TS(P).

When a process P requests for a resource the OS does the following:

(i) If no other process is currently holding the resource, the OS awards the resource to P.
(ii) If some process Q with TS(Q)<TS(P) is holding the resource, the OS makes P wait for 
     the resources.
(iii) If some process Q with TS(Q)>TS(P) is holding the resource, the OS restarts Q 
      and awards the resources to P.
(Restarting means taking back the resources held by a process, killing it and starting it 
again with the same timestamp)

When a process releases a resource, the process with the smallest timestamp (if any) amongst those waiting for the resource 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.



Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!