A process in a multiprogramming is said to be in a state of deadlock if it is waiting for a particular event that will not occur. In multi programmed computing systems, resource sharing is one of the primary goals of the operating system. When resources are shared among a population of users, each of whom maintains exclusive control over particular resources allocated to that user, it is possible for deadlocks to develop in which the processes of some users will never be able to finish.


If a process is given the task of waiting for an event to occur, and if the system includes no provision for signaling that event, then we have a one process deadlock. Several common examples of deadlock are

A Traffic Deadlock:

A number of automobiles are attempting to drive through a busy section of the city, but the traffic has become completely jammed. Traffic comes to a halt, and it is necessary for the police to unwind the jam by slowly and carefully backing cars out of the area. Eventually the traffic begins to flow normally, but not without much annoyance, effort and the loss of considerable time.

A Simple Resource Deadlock:

A simple examples of a resource deadlock is illustrated

This resource allocation graph shows two processes as rectangles and two resources as circles. An arrow from a resource to a process indicates that the resource belongs to, or has been allocated to the process. An arrow from a process to a resource indicates that the process is requesting, but has not yet been allocated, the resource. The diagram illustrates a deadlocked system: process A holds Resource 1 and needs Resource 2 to continue. Process B holds Resource 2 and needs Resource 1 to continue. Each process is waiting for the other to free a resource that it will not free until the other frees its resources that it will not do until the other from its resources , etc. This circular wait is characterized of deadlock systems.


Spooling systems are often prone to deadlock. A spooling system is used to improve system throughput by disassociating a program from the slow operating speeds of devices such as printers. For example, if a program sending lines to the printer must wait for each line to be printed before it can transmit the next line, then the program will execute slowly. To speed the program’s executing, output lines are routed to a much faster device such as a disk drive where they are temporarily stored until they may be printed. In some spooling systems, the complete output from a program must be available before actual printing can begin. Thus several partially complete jobs generating print lines to a spool file could become deadlocked if the available space fills before any job completes. Unwinding or recovering from such a deadlock might involve restarting the system with a loss of all work performed so far.
OS-Deadlock Reviewed by 1000sourcecodes on 22:52 Rating: 5
Powered by Blogger.