- An understanding of process resource graphs
- Resource allocation diagram of binary simplification
An understanding of process resource graphs
Markdown Editor is not too familiar with the table insert Picture This thing has not learned, tangled in Word summed up the next, and then cut a picture below for your reference:
The method of simplification resource allocation diagram
- The first step: see how many resources the system has left unallocated, and then see which processes are not blocked ("No blocking" that is, the system has enough free resources allocated to it)
- Step Two: Remove all the edges of the non-blocking process, form an isolated point, and then recycle the resources that the system allocates to the process
- Step three: See what the rest of the process does not block, and then turn them into isolated points.
- Fourth step: Finally, all the resources and processes become isolated points. Such a diagram is called "Fully simplified".
If a diagram is completely simplified, no deadlock occurs, and if a diagram is not completely simplified (that is, there is an "edge" in the diagram), a deadlock is generated. This is the "death lock".
Instance
- The first step: look at the R1 resource, it has three arrows is outward, so it is a total of 3 resources allocated to the process, at this time, R1 no idle resources remaining.
- The second step: look at the R2 resource, it has an arrow is outward, so it has allocated 1 resources for the process, at this time, R2 also left an idle resource is not allocated.
- The third step: Read the resources, then look at the process, first look at the process P2, it only applied for a R1 resources, but at this time R1 resources have been used up, so the process P2 into the blocking state, therefore, the process P2 temporarily can not be turned into an isolated point.
- The fourth step: look at the process P1, it only applies for a R2 resource, at this time, the system also has a R2 resource is not allocated, therefore, can meet the application of P1. In this way, the process P1 gets all of its required resources, so it does not go into a blocking state, it can run all the time, and when it finishes running, we release all of its resources. Equivalent: You can remove all the edges of the P1 and turn them into an isolated point, as shown in:
- Fifth step: After the process P1 run, release its resources (2 R1 resources and a R2 resource), after the system recycles these resources, the idle resources become 2 R1 resources and a R2 resource, because the process P2 has been requesting a R1 resource, so at this time, the system can meet its application. In this way, the process P2 gets all of its required resources, so it does not go into a blocking state, it can run all the time, and when it finishes running, we release all of its resources. Equivalent: You can remove all the edges of the P2 into an isolated point and become:
Since this resource allocation diagram can be completely simplified, no deadlock is generated.
If the points in the resource allocation diagram are not ultimately able to be isolated points, the process Resource graph cannot be completely simplified, resulting in deadlocks.
Teach You---process resource allocation