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