Deadlock Operating Systems (CC2011NI) -Mr. Pranoy Man Pradhan.

Slides:



Advertisements
Similar presentations
1 Concurrency: Deadlock and Starvation Chapter 6.
Advertisements

Chapter 5 Deadlocks. Contents What is deadlock? What is deadlock? Characterization Characterization Resource allocation graph Resource allocation graph.
Deadlock Prevention, Avoidance, and Detection
ICS Principles of Operating Systems Lectures 8 and 9 - Deadlocks Prof. Dmitri V. Kalashnikov dvk ics.uci.edu Slides © Prof. Nalini Venkatasubramanian.
Lecture 6 :Deadlocks. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involves.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Deadlock Prevention, Avoidance, and Detection.  The Deadlock problem The Deadlock problem  Conditions for deadlocks Conditions for deadlocks  Graph-theoretic.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
DEADLOCK. Contents  Principles of deadlock  Deadlock prevention  Deadlock detection.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 81 Deadlock is:  A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.  Example.
Ceng Operating Systems Chapter 2.4 : Deadlocks Process concept  Process scheduling  Interprocess communication  Deadlocks Threads.
Operating Systems COMP 4850/CISG 5550 Deadlock Avoidance Dr. James Money.
Chapter 3 Deadlocks TOPICS Resource Deadlocks The ostrich algorithm
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Deadlock CSCI 444/544 Operating Systems Fall 2008.
Concurrency: Deadlock & Starvation
The ‘deadlock’ conditions Reviewing some key points concerning the potential for ‘deadlock’ in an operating system.
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Chapter 7 – Deadlock and Indefinite Postponement
Chapter 6 Concurrency: Deadlock and Starvation
Silberschatz, Galvin and Gagne  Operating System Concepts Deadlock and Starvation Deadlock – two or more processes are waiting indefinitely for.
Concurrency: Deadlock and Starvation
Chapter 7 – Deadlock (Pgs 283 – 306). Overview  When a set of processes is prevented from completing because each is preventing the other from accessing.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance 3.6. Deadlock prevention.
1 Deadlocks 2 Resources Examples of computer resources –printers –tape drives –tables Processes need access to resources in reasonable order Suppose.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
1 Deadlocks Chapter 3. 2 Resources Examples of computer resources –printers –tape drives –tables Processes need access to resources in reasonable order.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
CS6502 Operating Systems - Dr. J. Garrido Deadlock – Part 2 (Lecture 7a) CS5002 Operating Systems Dr. Jose M. Garrido.
CIS Operating Systems Deadlock Professor Qiang Zeng Fall 2015.
Deadlock Operating Systems: Internals and Design Principles.
CS 346 – Chapter 7 Deadlock –Properties –Analysis: directed graph Handle –Prevent –Avoid Safe states and the Banker’s algorithm –Detect –Recover.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Chapter 6 Concurrency: Deadlock and Starvation
CS333 Intro to Operating Systems Jonathan Walpole.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings.
Summer 2015 SILICON VALLEY UNIVERSITY CONFIDENTIAL1 Operating Systems Dr. Jerry Shiao, Silicon Valley University.
Chapter 5 Process Management Semester 2. Objectives  What is a deadlock?  Seven cases of deadlocks  Conditions of deadlocks –Mutual exclusion.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
Informationsteknologi Monday, October 1, 2007Computer Systems/Operating Systems - Class 111 Today’s class Deadlock.
Deadlocks CPE Operating Systems
Lecture 6 Deadlock 1. Deadlock and Starvation Let S and Q be two semaphores initialized to 1 P 0 P 1 wait (S); wait (Q); wait (Q); wait (S);. signal (S);
Sistem Operasi IKH311 Deadlock. 2 Resources Examples of computer resources printers tape drives tables Processes need access to resources in reasonable.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
OPERATING SYSTEM CONCEPTS AND PRACTISE
Process Management Deadlocks.
Chapter 5 - Process Management
ITEC 202 Operating Systems
Chapter 7 – Deadlock and Indefinite Postponement
Chapter 6 : Deadlocks What is a Deadlock?
Chapter 12: Concurrency, Deadlock and Starvation
ICS 143 Principles of Operating Systems
Chapter 7 Deadlock.
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Deadlocks Definition A set of processes is in a Deadlock state when every process in the set is waiting for an event that can only be caused by another.
DPNM Lab. Dept. of CSE, POSTECH
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlocks Session - 13.
DEADLOCK.
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Introduction to Deadlocks
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Chapter 8: Deadlocks Deadlock Characterization
Presentation transcript:

Deadlock Operating Systems (CC2011NI) -Mr. Pranoy Man Pradhan

Deadlock Deadlock is the undesirable state of the system and is defined as the situation where a process or a set of processes are blocked waiting for some resource that his held by some other blocked processes. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

Deadlocked processes wait for an event, which has to be triggered by other blocked processes, which never happens and hence processes are permanently blocked. Deadlock is defined as the permanent blockage of a set of processes that are competing for the resources or communicating with each other.

Example of Deadlock.

In above figure – Process P1 has acquired resource R1 and Process P2 has acquired resource R2 – Process P1 is waiting for resource R2 to be released by process P2 – Process P2 is waiting for resource R1 to be released by process P1; which never succeeds and hence processes are blocked.

Conditions for Deadlock Following four conditions must simultaneously hold for deadlock to occur – Mutual Exclusion. – Hold and Wait. – No Preemption. – Circular wait.

Conditions for Deadlock. Mutual Exclusion. – A resource can be used by only one process at a time. – If some process requests for a resource which is being held by another process, the requesting process is excluded or denied of the resource and has to wait until the resource has been released. Hold and wait. – A process may hold allocated resources while awaiting assignment of other resources.

Conditions of Deadlock No Preemption – A resource cannot be forcibly taken away from the process which is currently using the resource. The first three conditions are necessary but not sufficient for deadlock to occur. For a deadlock to actually take place, following fourth condition is required:

Conditions of Deadlock Circular Wait – A closed circular chain of processes exists such that each process holds at least one resource needed by the next process in the chain as shown in above figure.

Solution ? Four major areas of interest in deadlock research – Deadlock prevention. – Deadlock avoidance. – Deadlock detection. – Deadlock recovery.

Deadlock Prevention. – Use policies that will prevent the occurrences of deadlock. – Deadlock can be prevented from preventing any one of the four condition that is required for the occurrence of deadlock. – If any one of the condition can be prevented from holding, then deadlock will not occur.

Deadlock Avoidance. – Deadlock can be avoided by maintaining the system in safe state by careful allocation of system resources. – A system is said to be in safe state, if all pending processes can successfully be executed in some sequence satisfying all pending process requirements completely. – It is OS that checks whether the system will be in safe or unsafe state after the allocation of requested resources.

Deadlock Recovery. – Clears deadlocks from system so that deadlocked processes may complete their execution and free their resources. – Process termination : Abort one process at a time until the deadlock cycle is eliminated.

Deadlock detection. – Used in systems in which deadlocks can occur. – Determines if deadlock has occurred – Identifies those processes and resources involved in the deadlock. – Deadlock detection algorithms can incur significant runtime overhead.

Indefinite Postponement Also known as starvation. Typically occurs when a process is waiting in line for other processes (probably of higher priority). Processes with higher priority are allowed to get in front of the queue. Bypasses the waiting process. Determined by the scheduling algorithms. Preemption plays a big role.

Indefinite Postponement In a dynamic system, requests for resources happen all the time. Some policy is needed to make a decision about who gets which resource when. This policy, although seemingly reasonable, may lead to some processes never getting service even though they are not deadlocked. Can be as dangerous as deadlock.

Indefinite Postponement Possible solution : – ageing Eventually the waiting process's priority will exceed the priorities of all processes and it will be serviced. – FCFS resource allocation policy. the process waiting the longest gets served next.

Deadlock v/s Indefinite postponement Deadlock is more serious than Indefinite postponement. Deadlock: – all set of processes that are waiting for resources that never become available are affected. Indefinite postponement (starvation). – only a specific process is affected.

Self study Deadlock : Examples.