Remember if the resource allocation graph has a cycle and every resource has a single instance then it implies that a deadlock has occurred. The process P 3 has not requested for any resource instance but is holding the instance for resource R 3. The process P 2 has requested for the instance of resource R 3 and is already holding the instances of resource R 1 and R 3. The figure below shows that the process P 1 has requested for the instance of resource R 1 is already holding the instance of resource R 2. Let us check the status of the processes. Observe the figure above that the resource R 1 has only one instance, resource R 2 has two instances, resource R 3 has one instance, and resource R 4 has three instances. Consider we have following set of nodes and edges. To understand deadlock we let us take an example. Although the assignment edge nominates the dot (instance) to a process. The request edge always points to the resource rectangle in the graph, not to dots (instance) inside the rectangle. If the resource is able to allocate the resource instance to the requesting process then immediately the request edge is converted to assignment edge. When a process request for an instance of the resource it directs a request edge to the resource. If a resource has multiple instances then it is denoted by the dots inside the rectangle. In the graph, resources are denoted by the rectangles and the processes are denoted by the circles. The assignment edge is the directed edge from the instance of resource R j to the process P i i.e. ![]() Well, when a resource is allotted to some process then it is denoted by the assignment edge. The request edge is a directed edge from the requesting process P i to requested resource R j i.e. When a process requests for a resource it denoted by the request edge in the resource-allocation graph. Where P is the set of vertices indicating the set of active processes and R is the set of vertices indicating all types of resources in the system. Further, the set of vertices can be classified into two types of nodes P and R. Like every graph, it also has a set of vertices and a set of edges. The system reallocation graph is a directed graph that briefs you about the deadlock more precisely. Now the process P 0 is waiting to acquire the process held by the P 1, further the process P 1 is waiting to acquire the resource held by P 2, …., process P 4 is waiting to acquire the resource held by P 0. Let us discuss this with an example there are five processes i.e. This is similar to hold and waits the only difference is that the processes are waiting in a circular pattern. The processes must be waiting in a circular pattern to acquire the resource. Instead, the process must voluntarily release the resource it has acquired when the task of the process has been completed. The hold and wait condition simply means that the process must be holding access to one resource and must be waiting to get hold of other resources that have been acquired by the other processes.Ī process acquiring a resource, cannot be preempted in between, to release the acquired resource. The mutual exclusion condition prevents two or more processes to access the same resource at a time. ![]() While the other processes requesting the same resource must wait and delay their execution until it has been released. The mutual exclusion condition, allow only a single process to access the resource at a time. In a multiprogramming environment, there may be several processes requesting the same resource at a time. ![]() ![]() The four conditions that must sustain at the same time to eventuate a deadlock are: mutual experience, hold and wait, no preemption, circular wait. In this content, we will discuss the characteristics that are essential for the occurrence of deadlock.
0 Comments
Leave a Reply. |