How can the deadlock be prevented?
To evade deadlocks first we will have to obtain the information about how resources are to be requested. And as well we should make sure that it does not have the necessary condition to have a deadlock.
There are deadlock avoidance algorithms to prevent the deadlock, they are as:
- Safe state
- Resource allocation graph algorithm
- Bankers algorithm
- Safety algorithm
- Resource request algorithm