



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of deadlocks in operating systems, a situation where processes are blocked due to resource allocation. It discusses the four necessary conditions for deadlocks, strategies for handling them, and the use of resource allocation graphs for detection. Deadlock Ignorance, Prevention, Avoidance, and Detection & Recovery are the strategies covered.
Typology: Lab Reports
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Consider an example when two trains are coming toward each other on same track and there is only one track, none of the trains can move once they are in front of each other. Similar situation occurs in operating systems when there are two or more processes hold some resources and wait for resources held by other(s). For example, in the below diagram, Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1.
A process in operating systems uses different resources and uses resources in following way.
In simple words, The OS reviews each allocation so that the allocation doesn't cause the deadlock in the system. We will discuss Deadlock avoidance later in detail.
This approach let the processes fall in deadlock and then periodically check whether deadlock occur in the system or not. If it occurs then it applies some of the recovery methods to the system to get rid of deadlock. We will discuss deadlock detection and recovery later in more detail since it is a matter of discussion.
In some cases deadlocks can be understood more clearly through the use of Resource-Allocation Graphs , having the following properties: A set of resource categories, { R1, R2, R3,.. ., RN }, which appear as square nodes on the graph. Dots inside the resource nodes indicate specific instances of the resource. ( E.g. two dots might represent two laser printers. ) A set of processes, { P1, P2, P3,.. ., PN } Request Edges - A set of directed arcs from Pi to Rj, indicating that process Pi has requested Rj, and is currently waiting for that resource to become available. Assignment Edges - A set of directed arcs from Rj to Pi indicating that resource Rj has been allocated to process Pi, and that Pi is currently holding resource Rj. Note that a request edge can be converted into an assignment edge by reversing the direction of the arc when the request is granted. ( However note also that request edges point to the category box, whereas assignment edges emanate from a particular instance dot within the box. )
Figure 1 - Resource allocation graph
at least one of the necessary conditions never holds. A method for avoiding deadlocks that is less stringent than the prevention algorithms requires that the operating system have a priori information on how
. each process will utilize system resources