CS 551: Distributed Deadlock, Resource Allocation Graphs.
I don't think that the graph can prove that the given code has a deadlock; but if we already know how the deadlock happens, we can draw the above graph resource allocation graph for that deadlock, and then show that there is a cycle. A cycle indicates a deadlock if the resources are not multiply instantiated, which they are not: S1, S2 and S3 are single, one-instance resources.).
![Resource Allocation Graph Homework Solution](assets/images/icons/service-1.png)
Create a random allocation matrix with a value between the range of 0 to 5 for every resource and processes. Print the allocation matrix.
![Resource Allocation Graph Homework Solution](assets/images/icons/service-2.png)
The Deadlock avoidance algorithm examines the resource allocations so that there can never be a circular wait condition. Safe and Unsafe States The resource allocation state of a system can be defined by the instances of available and allocated resources, and the maximum instance of the resources demanded by the processes.
![Resource Allocation Graph Homework Solution](assets/images/icons/service-3.png)
Deadlocks can be explained more precisely in terms of a directed graph called a system resource allocation graph. This graph having of a set of vertices V and a set of edges E. The set of vertices V is partitioned into two dissimilar types of nodes; P the set having of all active processes in the system and R the set consisting of all resource types in the system.
![Resource Allocation Graph Homework Solution](assets/images/icons/service-4.png)
To keep your solution as simple as possible, do not allocate or bounds check it. You can also assume all requests satisfy the constraints above (i.e., your code should not check that the process always requests less than M amount of memory). Deadlock. What does a resource allocation graph show? What does a cycle in the the resource graph mean.
![Resource Allocation Graph Homework Solution](assets/images/icons/service-5.png)
Fig. 6-3 shows the concept of a resource graph. Do illegal graphs exist, that is, graphs that structurally violate the model we have used of resource usage? If so, give an example of one. (Book Problem 6.5, pg 463) Suppose that there is a resource deadlock in a system.
![Resource Allocation Graph Homework Solution](assets/images/icons/service-6.png)
If a resource allocation graph contains a cycle, and only one instance per resource type There is a deadlock If a resource allocation graph contains a cycle, and multiple instances per resource type.