Question: Consider a system with four resource types as follows: Resource Type Number of Instances RT 1 6 RT 2 9 RT 3 1 2 RT

Consider a system with four resource types as follows:
Resource Type Number of Instances
RT16
RT29
RT312
RT45
The following table presents the maximum resource needs for each process for each of the four resource types:
Process Max RT1 Need Max RT2 Need Max RT3 Need Max RT4 Need
P15684
P23743
P34572
In the following sequence of resource requests, let REQ(A, N1, N2, N3, N4) represent a request from process A for N1 resources of type RT1, N2 resources of type RT2, N3 resources of type RT3 and N4 resources of type RT4:
REQ(P1,0,1,3,0)
REQ(P3,3,0,3,0)
REQ(P1,0,1,0,1)
REQ(P2,0,1,0,0)
REQ(P3,0,3,1,0)
REQ(P2,1,0,0,1)
The above sequence of resource requests can be granted safely without any danger of leading the system into a deadlock situation. Determine the set of resources available after processing the above sequence of requests and the remaining resource needs of the processes. Verify that a safe sequence of resource allocation to the processes does exist in this situation.
Now, consider the following additional requests for resources. For each request, determine if it can be granted safely in a manner that avoids deadlocks. Identify the request that can be safely granted.
a) REQ(P1,1,0,2,0)
b) REQ(P1,0,1,3,0)
c) REQ(P1,1,2,0,0)
d) REQ(P2,0,1,0,2)
Consider a system with ten resources and four processes competing for them. Let process P1 have a maximum need of seven resources, process P2 have a maximum need of five resources, process P3 have a maximum need of eight resources and process P4 have a maximum need of six resources.
Let [a1, a2, a3, a4] represent the allocation vector with respect to the resources currently allocated to the processes P1 through P4, in that order. The system is deemed to be in a safe state with respect to an allocation vector if there is a possibility of allocating the remaining resources in such a way as to satisfy the maximum needs of all the processes.
Examine each of the following allocation vectors and determine if it is safe or not. Identify the one that is NOT safe?
a)[1,2,1,4]
b)[3,1,1,2]
c)[0,3,1,3]
d)[2,0,2,4]
In order to prevent deadlocks, let a system adopt the policy of forcing processes to request resources in ascending order of request type rank. In particular, when a process is requesting a resource of a certain type, the process cannot be holding other higher ranked resources.
Consider four resource types with the following profile in this system:
Resource Type Rank Number of Instances
RT142
RT274
RT383
RT4102
Let the following sequence of resource requests be processed by the system (note that REQ(A, B, k) represents the request of k resources of type B by process A and REL(A, B, k) represents process A releasing k resources of type B):
REQ(P4, RT2,3)
REQ(P3, RT3,2)
REQ(P2, RT4,1)
REL(P4, RT2,3)
REQ(P4, RT1,2)
REL(P2, RT4,1)
REL(P3, RT3,2)
REQ(P3, RT2,3)
REQ(P2, RT3,2)
REQ(P1, RT4,2)
Note that all of the above request and release operations can be processed without any violation of the deadlock-prevention policy of the system.
For each of the following sequences of request/release operations, examine if it can or cannot be processed without violating the deadlock-prevention scheme above. Identify the sequence that is allowed by the scheme and consequently can be processed without leading to system deadlock?
a) REL(P2, RT3,2), REQ(P3, RT4,2), REQ(P2, RT1,2), REQ(P1, RT2,2)
b) REQ(P4, RT3,3), REL(P3, RT2,3), REQ(P3, RT3,3), REQ(P2, RT1,2)
c) REL(P2, RT3,2), REQ(P4, RT4,2), REQ(P2, RT4,2), REQ(P1, RT1,2)
d) REQ(P2, RT4,2), REL(P3, RT2,3), REQ(P4, RT2,2), REQ(P3, RT1,2)
Consider six process P1, P2, P3, P4, P5 and P6 operating on four resources W, X, Y and Z. Let REQ(A, B) denote that process A requests resource B and let REL(A, B) denote that process A releases resource B.
Let the system state be such that process P1 is holding resource W, process P3 is holding resource X, process P4 is holding resource Y and process P6 is holding resource Z. Construct a resource-allocation graph reflecting this state of the system. For each of the following sequences of REQ and REL operations, modify the resource-allocation graph appropriately and determine if the sequence causes a deadlock. Identify the sequence that is deadlock free.
a) REQ(P2, X), REQ(P2, Z), REL(P3, X), REQ(P6, X)
b) REQ(P2, X), REL(P3, X), REQ(P4, X), REQ(P2, Y)
c) REQ(P1, X), REL(P4, Y), REQ(P3, W), REL(P6, Z)
d) REQ(P3, W), REQ(P2, Z), REL(P6, Z), REQ(P4, X)

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!