Question: Consider a system employing a deadlock - avoidance scheme based on pre - declaration of resource needs for various processes. In particular, the resource needs

Consider a system employing a deadlock-avoidance scheme based on pre-declaration of resource needs for various processes. In particular, the resource needs of the processes are represented by claim arcs in the resource-allocation graph. Whenever a resource request by a process is issued, it is rejected by the system if the newly formed allocation arc (from the resource vertex to the process vertex) replacing the corresponding claim arc (from the process vertex to the resource vertex) closes a cycle in the resource-allocation graph. Otherwise, the system grants the request and converts the claim arc to the allocation arc in the resource-allocation graph.
Let P1, P2 and P3 be three processes in the system. Let P1 declare that it may request resources W, X and Y; P2 declare that it may request resources X, Y and Z; P3 declare that it may request resources W, Y and Z. Construct the resource-allocation graph with the appropriate claim arcs.
Consider each of the following pairs of resource requests. Based on the resource-allocation graph constructed above, identify the pair of requests among the following that can be granted without a deadlock possibility?
a) P1 requesting W and P3 requesting Y
b) P1 requesting X and P2 requesting Z
c) P2 requesting Z and P3 requesting Y
d) P2 requesting Y and P3 requesting Z
Let a system allocate resources to processes as long as the system state remains safe with respect to deadlocks. Note that a system state is safe if there is a way to allocate the remaining resources in such a manner as to satisfy the maximum needs of all the processes.
With respect to a resource R, let the system have 10 instances of the resource and let there be five processes P1, P2, P3, P4 and P5 that have maximum needs of 5,7,4,9 and 8 instances of the resource respectively.
Start with a safe state in which P1 is holding no instances, P2, P3 and P4 are holding two instances each and P5 is holding one instance of R. Now, consider each of the following requests. For each request, determine if it can be granted while keeping the system in a safe state. Identify the request that can be granted safely.
a) P5 requesting two instances of R
b) P5 requesting one instance of R
c) P4 requesting two instances of R
d) P3 requesting two instances of R
Consider a system in which processes post resource requests that are treated as follows. If the resource is free (not currently held by any other process), it is granted to the process. If the resource is currently held by some other process, the requesting process is thus notified. A process that could not obtain a requested resource can continue to post requests for more resources. However it cannot complete its work without obtaining all the resources it has requested. Whenever a process terminates it releases all the resources it had obtained.
In the following sequence of requests, let REQ(A, B) denote process A requesting resource B:
REQ(P10, R1)
REQ(P1, R8)
REQ(P8, R2)
REQ(P5, R4)
REQ(P2, R7)
REQ(P6, R3)
REQ(P4, R5)
REQ(P3, R6)
REQ(P4, R7)
REQ(P7, R5)
REQ(P9, R4)
REQ(P3, R7)
REQ(P2, R3)
REQ(P5, R8)
REQ(P2, R4)
REQ(P8, R1)
REQ(P7, R6)
REQ(P5, R2)
REQ(P1, R1)
REQ(P10, R7)
REQ(P6, R6)
REQ(P5, R1)
Construct a wait-for graph for the above sequence of requests. A wait-for graph has the set of processes as its vertices. An arc Pi->Pj represents that process Pi is waiting for a resource that is held by process Pj. Cycles in the wait-for graph correspond to deadlocks in the system. Based on the wait-for graph, identify the process, among those given below, that is NOT part of any deadlock.
a) P5
b) P3
c) P2
d) P4
Consider a system with eight resources currently allocated as follows:
Resource Allocated to Process
R1 P4
R2 P1
R3 P5
R4 P7
R5 P2
R6 P8
R7 P3
R8 P6
The following sequence of additional resource requests is then processed. (Let REQ(A,B) denote process A's request for resource B.)
REQ(P4, R2)
REQ(P3, R6)
REQ(P2, R1)
REQ(P7, R7)
REQ(P6, R1)
REQ(P5, R7)
The above sequence of requests do not cause a deadlock. Verify this fact by constructing a resource-allocation graph involving R1 through R8 and P1 through P8.
For each of the following resource requests, add an arc to the resource-allocation graph and examine if the resource request causes a deadlock in the system. Identify the request, among the following, that does NOT cause a deadlock.
a) REQ(P3, R3)
b) REQ(P8, R3)
c) REQ(P8, R8)
d) REQ(P3, R4)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!