Deadlock PDF
Document Details
Uploaded by RichTourmaline9881
Yakın Doğu Üniversitesi Dişhekimliği Fakültesi
Tags
Summary
This document discusses the concept of deadlock in operating systems. It explains the four necessary conditions for a deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. The author uses a staircase example to illustrate these concepts.
Full Transcript
Deadlock The deadlock involves the interaction of several processes and resources, deadlock is preceded by the simultaneous occurrence of four conditions that the operating system (or other systems) could have recognized: mutual exclusion, resource holding, no preemption, and circular wait. It’s imp...
Deadlock The deadlock involves the interaction of several processes and resources, deadlock is preceded by the simultaneous occurrence of four conditions that the operating system (or other systems) could have recognized: mutual exclusion, resource holding, no preemption, and circular wait. It’s important to remember that each of these four conditions is necessary for the operating system to work smoothly. None of them can be removed easily without causing the system’s overall functioning to suffer. Therefore, the system needs to recognize the combination of conditions before they occur and threaten to cause the system to lock up. To illustrate these four conditions, let’s revisit the staircase example from the beginning of the chapter to identify the four conditions required for a deadlock. When two people meet between landings, they can’t pass because the steps can hold only one person at a time. Mutual exclusion, the act of allowing only one person (or process) to have access to a step (a dedicated resource), is the first condition for deadlock. When two people meet on the stairs and each one holds ground and waits for the other to retreat, that is an example of resource holding (as opposed to resource sharing), the second condition for deadlock. In this example, each step is dedicated to the climber (or the descender); it is allocated to the holder for as long as needed.This is called no preemption, the lack of temporary reallocation of resources, and is the third condition for deadlock. These three lead to the fourth condition of circular wait in which each person (or process) involved in the impasse is waiting for another to voluntarily release the step (or resource) so that at least one will be able to continue on and eventually arrive at the destination. All four conditions are required for the deadlock to occur, and as long as all four conditions are present the deadlock will continue; but if one condition can be removed, the deadlock will be resolved. In fact, if the four conditions can be prevented from ever occurring at the same time, deadlocks can be prevented. Although this concept is obvious, it isn’t easy to implement.