Chapter VI Deadlocks Jehan-François Pâris

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 7: Deadlocks Adapted by Donghui Zhang from the original version by Silberschatz et al.
Advanced Operating Systems
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
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.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
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.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Basics of Deadlock Theory.
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.
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.
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.
With slides from C. Griwodz, K. Li, A. Tanenbaum and M. van Steen
Chapter 6 Concurrency: Deadlock and Starvation
Deadlocks. 2 System Model There are non-shared computer resources –Maybe more than one instance –Printers, Semaphores, Tape drives, CPU Processes need.
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
Deadlock CSCI 444/544 Operating Systems Fall 2008.
Concurrency: Deadlock & Starvation
02/18/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
The ‘deadlock’ conditions Reviewing some key points concerning the potential for ‘deadlock’ in an operating system.
1 Lecture 8: Deadlocks Operating System Spring 2008.
OS Spring 2004 Concurrency: Principles of Deadlock Operating Systems Spring 2004.
Witawas Srisa-an Chapter 6
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Bridge Crossing Example Traffic only in one direction. Each section.
Chapter 6 Deadlocks Resources Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
1 Processes, Threads, Race Conditions & Deadlocks Operating Systems Review.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
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 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.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
This Time - Deadlock Definition Conditions for deadlocks
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Deadlock Operating Systems: Internals and Design Principles.
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 Operating Systems: Internals and Design Principles, 6/E William Stallings.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 6 Deadlocks Slide 1 Chapter 6 Deadlocks.
Deadlock. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Deadlocks.
Deadlocks 12/02/2015. What is a deadlock ? System has a finite set of resources. Resource can have one or more instances. Processes compete for resources.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
Informationsteknologi Monday, October 1, 2007Computer Systems/Operating Systems - Class 111 Today’s class Deadlock.
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);
Deadlock. Examples You can't get a job without experience; you can't get experience without a job. A set of blocked processes each holding a resource.
Concurrency: Deadlock and Starvation
ITEC 202 Operating Systems
Chapter 12: Concurrency, Deadlock and Starvation
Operating Systems (CS 340 D)
Advanced Operating System Fall 2009
ICS 143 Principles of Operating Systems
Chapter 7 Deadlock.
Chapter 7 Deadlocks.
Chapter 7: Deadlocks.
Process Deadlocks.
Chapter 7: Deadlocks.
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.
Deadlocks Session - 13.
Jehan-François Pâris Chapter VI Deadlocks Jehan-François Pâris
Presentation transcript:

Chapter VI Deadlocks Jehan-François Pâris

Chapter overview Deadlocks Necessary conditions for deadlocks Deadlock prevention

Deadlocks A deadlock is said to occur whenever –Two or more processes are blocked –Each of these processes is waiting for a resource that is held by another blocked process.

Examples Two friends have exchanged insults – Each is expecting the other to apologize first A rebel group does nor want to cease the hostilities before being recognized by the government –The government is ready to negotiate but only after the hostilities have ceased

A graphic view Alan A’s Apology B’s Apology Bob wants holds on

A graphic view Alice Milk Sugar Bob wants holds on

A graphic view want wants hold on holds on want Rebels Negotiations Gov’t Cease-fire

Elements Processes Resources P R

Relations Process P holds on/owns resource R Process P needs/wants resource R P holds on R needs R P

Serially reusable resources Memory space, buffer space, disk space, USB slot to insert a flash drive Exist only in a limited quantity One process may have to wait for another process to release the resources it is currently holding.

Consumable resources Cannot be reused Messages are best example: – "Owned" by the process that creates them until it releases them – "Wanted" by the process that will receive them

Handling deadlocks Do nothing : Ignore the problem Deadlock prevention : Build deadlock-free systems Deadlock avoidance : Avoid system states that could lead to a deadlock Deadlock detection : Detect and break deadlocks

Handling deadlocks Do nothing : Ignore the problem Deadlock prevention : Build deadlock-free systems Deadlock avoidance : Avoid system states that could lead to a deadlock Deadlock detection : Detect and break deadlocks

Haberman’s conditions Four necessary conditions must all be in effect for deadlocks to happen: – Mutual Exclusion – Hold and Wait – No Preemption – Circular Wait

Mutual exclusion At least one of the processes involved in the deadlock must claim exclusive control of some of the resources it requires

Hold and wait Processes can hold the resources that have already been allocated to them while waiting for additional resources

No preemption Once a resource has been allocated to a process, it cannot be taken away or borrowed from that process until the process is finished with it

Circular wait There must be a circular chain of processes such that each process in the chain holds some resources that are needed by the next process in the chain. – Formal equivalent to what we call a vicious circle

Deadlock prevention Any system that prevents any of the four necessary conditions for deadlocks will be deadlock-free Must find the easiest condition to deny

Denying mutual exclusion Prevent any process from claiming exclusive control of any the resource Drawbacks –Many resources can only be used by one process at a time –Cannot hold on a message and send it at the same time

Denying hold and wait Require processes to get all the resources they will need or none of them Drawbacks – Forces processes to acquire ahead of time all the resources they might need –Does not apply the consumable resources such a messages

Allowing preemption Let processes take away or borrow the resources they need from the processes that hold on them Drawbacks –Will result in lost work when a process steals storage space from another process –Cannot force processes to send messages

Denying circular wait (I) Impose a total order on all resource types and force all processes to follow that order when they acquire new resources If a process needs more than one unit of a given resource type it should acquire all of them or none

Denying circular wait (II) Works very well for resources like CPU and memory Drawbacks –Would force messages to move in only one direction Processes could not exchange messages