As stated in previous topic, in Deadlock situation, a process waits resources which are using by other process without releasing its own resources. It is therefore causes all the processes waiting and waiting for the resources of each other; hence it brings critical condition to make deadlock condition.
In this chapter, we are going to model deadlock condition by using directed graph. Here we use directed graph to show whether it is requesting resources or holding resources. And circle are used to denote process whereas rectangle refers the resources.
Above diagram shows the modelling process of deadlock, it shows requesting and holding of resources in/from a process. In the figure, A process is requesting T resource one time. In the bottom fig, A is holding T resource.In this chapter, we are going to model deadlock condition by using directed graph. Here we use directed graph to show whether it is requesting resources or holding resources. And circle are used to denote process whereas rectangle refers the resources.
In fact, there is not solution of deadlock condition, that is why it is known as non-resolving situation. But a good programmer must be known with this fact before working on any project. S/he must be careful about the dealing of deadlock. A programmer has to consider 4 strategies to deal with deadlock. They are as follows:
- Ignoring the deadlock problem
- Detection and Recovery
- Avoiding Dynamically with Resource Allocation
- Prevention of Deadlock
Above four strategies are common and most important part of a programmer. S/he must apply one of these strategies which helps them to deal with deadlock. But among them prevention and dynamic avoidance are the best away of dealing with deadlock because it does not let deadlock condition to occur in a task like the speech "Prevention is better than cure".
Ignoring can not be solution of any problem; ignoring of that problem obviously damages and lose something of your task. Detection and recovery somewhat can get back your data and information by detecting that deadlock. Allocating resources carefully in the different processes, a programmer can keep away the task out of the deadlock condition dynamically.