Deadlock
A deadlock occurs when each computer waits for a resource that another process is holding. It is important to prevent a deadlock before it can occur. The resource scheduler can detect a deadlock occurrence, which helps the operating system track resources allocated to different processes. A deadlock can occur if the following four conditions hold simultaneously:
•No preemptive action—A resource can be released only voluntarily by the process holding it after that process has finished its task.
•Mutual exclusion—A special binary semaphore used to control access to the shared resource that enables current higher-priority tasks to be kept blocked for the shortest time possible.
•Hold and wait—In this condition, processes must be stopped from holding single or multiple resources while simultaneously waiting for one or more others.
•Circular wait—It imposes a total ordering of all resource types. Circular wait also requires that every process requests resources in increasing order of enumeration.
There are three ways to handle a deadlock:
•Do not let the system get into a deadlock state.
•Let the deadlock happen, then attempt to prevent it while it occurs.
•If a deadlock occurs, restart the system.