Deadlock Avoidance (brief) CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.

Slides:



Advertisements
Similar presentations
Deadlock 2.
Advertisements

Chapter 7: Deadlocks.
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.
Lecture 11 “Banker ’ s algorithm”.  Multiple instances.  Each process must a priori knowledge claim maximum use.  When a process requests a resource.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Deadlock Avoidance CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Chapter 7: Deadlocks (Continuation). 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks.
Resource Allocation, Deadlock and Banker’s Algorithm Supplementary Notes Dr. R. D. Kent Last modified: Dec. 11, 2006.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 30 Handling Deadlock.
Deadlocks CS 3100 Deadlocks1. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
1 Wednesday, June 28, 2006 Command, n.: Statement presented by a human and accepted by a computer in such a manner as to make the human feel that he is.
Chapter 7. Deadlocks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
03/07/2007CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 7: Deadlock Dr. Mohamed Hefeeda.
02/19/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
03/03/2004CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 7: Deadlock Dr. Mohamed Hefeeda.
What we will cover…  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 Deadlocks.
Chapter 7: Deadlocks Adapted to COP4610 by Robert van Engelen.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks Modified.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Cosc 4740 Chapter 6, Part 4 Deadlocks. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
CHAPTER 8: DEADLOCKS System Model Deadlock Characterization
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Chapter 81 Deadlock Avoidance Technique  Resource Allocation Denial: Grant incremental resource requests if we can prove that this leaves the system in.
1 Advanced Operating Systems - Spring 2009 Lecture 10 – February 11, 2009 Dan C. Marinescu Office: HEC 439 B. Office.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks System Model Deadlock Characterization Methods.
Chapter 7: Deadlock Course Administration n Midterm exam next week in class l Closed book n Final exam time changed to during class.
Lecture 12 Handling Deadlock – Prevention, avoidance and detection.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2CSCI 380 – Operating Systems Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
CS307 Operating Systems Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
Chap 7 Deadlocks. Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 6 Deadlocks Slide 1 Chapter 6 Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 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.
Deadlocks CPE Operating Systems
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
CSE Operating System Principles Deadlocks. CSE – Operating System Principles2 Overview System Model Deadlock Characterization Methods for.
Chapter 7: Deadlocks. The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks.
OPERATING SYSTEM CONCEPTS AND PRACTISE
CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Chapter 7: Deadlocks.
Deadlock B.Ramamurthy CSE421 1/11/2019 B.Ramamurthy.
Outline Deadlocks, dead lock prevention, avoidance.
Deadlock Prevention Restrain the ways request can be made.
Deadlocks Session - 14.
Lecture 28 Syed Mansoor Sarwar
Deadlock B.Ramamurthy CSE421 2/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 4/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 5/1/2019 B.Ramamurthy.
CSCI 315 Operating Systems Design
Banker’s Algorithm Anawil
Chapter 7: Deadlocks.
Deadlock B.Ramamurthy CSE421 8/28/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 9/3/2019 B.Ramamurthy.
Presentation transcript:

Deadlock Avoidance (brief) CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han

Announcements HW #4 is due Tuesday March 8, 11 am –extra office hours Monday March 7, 2 pm PA #2 assigned, due Thursday March 17 11:55 pm Midterm is Thursday March 10 –covers chapter 1-10 –Midterm review is Tuesday March 8 Read chapter 10

From last time... We discussed: –Deadlock Avoidance –Is the system in a safe state? Finding a safe sequence –Banker’s (Safety) Algorithm 4 steps, iterative An example was given Let’s finish up the examples

Deadlock Avoidance Banker’s Algorithm determines whether the system is in a safe state Suppose we have a new request, and the current system is in a safe state –Should we grant the new request? –Yes, if it leaves the system in a safe state.

Deadlock Avoidance Resource-Request Algorithm associated with the Banker’s Algorithm Let Request i be a new request vector for resources for process P i 1.If Request i ≤ Need i, go to step 2. Else, the new request exceeds the maximum claim. Exit. 2.If Request i ≤ Available, go to step 3. Else, process P i must wait because there aren’t enough available resources 3.Temporarily modify Available[j], Need[i,j], and Alloc[i,j] Avail -= Request i Alloc i += Request i Need i -= Request i Execute the Banker’s Safety algorithm to see if the system is in a safe state. If so, grant the request and permanently update Avail, Need, and Alloc. If not, P i must wait for more resources to be freed before Request i can be granted. Restore the old state.

Deadlock Avoidance Example 3 from previous lecture: –3 resources (A,B,C) with total instances available (10,5,7) –5 processes –At time t0, the allocated resources Alloc[i,j], Max needs Max[i,j], and Available resources Avail[j], are: Alloc[i,j] A B C P0 P1 P2 P3 P4 Max[i,j] A B C Avail[j] A B C Need[i,j] A B C where Need[i,j] is computed given Alloc[i,j] and Max[i,j] Banker’s Algorithm found that this was in a safe state, with safe sequence

Deadlock Avoidance Suppose we have a new request from process P1, Request 1 =. –Can the system satisfy this request without becoming unsafe? Execute the Resource- Request Algorithm. 1.Request 1 ≤ Need 1 = 2.Request 1 ≤ Available = 3.Temporarily recompute Avail, Need, and Alloc see next slide

Deadlock Avoidance Execute Banker’s Algorithm on this revised state. We find that the sequence is safe. Thus we can grant the Request 1 immediately, and permanently update the matrices and vectors. Alloc’[i,j] A B C P0 P1 P2 P3 P4 Max[i,j] A B C Avail’[j] A B C Need’[i,j] A B C temporarily modified

Deadlock Avoidance Given this new state, suppose we have a 2 nd request: –from P4, such that Request 4 =. Show that this cannot be granted because Request 4 ≤ Available =. That is, there are not enough available resources. –from P0, such that Request 0 =. Show that this cannot be granted because no safe sequence can be found.

Deadlock Detection Though I discussed in class a somewhat sophisticated deadlock detection algorithm that is similar to the Banker’s Algorithm, I’ve decided not to include it in the slides pre-midterm, and it won’t be covered on the midterm