Summary


The system is in a deadlock state when two or more processes are waiting indefinitely for an event that can be caused only by one of the waiting processes. There are different ways to deal with deadlock which are:
The system will not be in the deadlock state using deadlock prevention or avoidance methods.
The system can be in a deadlock state, and then the deadlock is detected and recovered.
The system ignores the deadlock.

The four necessary conditions that have to be hold simultaneously such that the system will be in a deadlock state are: mutual exclusion, hold and wait, no preemption, and circular wait. The deadlock prevention ensures that one of these four conditions does not hold.

To avoid deadlock, the operating system has to have information about the resources needed for each process. The banker's algorithm is a deadlock avoidance algorithm that requires a priori information about the maximum number of each resource class that may be requested by each process.
If the system allows the deadlock to occur, then it may provide a method for deadlock detection and recovery. The deadlock recovery can be done using terminating processes in the deadlock cycle or preempting the resources in some of processes in the deadlock state.
An integrated deadlock strategy can be used. It classifies the system resources into different groups and applies different deadlock strategy for each category.