CSE 451: Operating Systems Winter 2004 Module 8 Deadlock

Slides:



Advertisements
Similar presentations
Operating Systems Lecture Notes Deadlocks Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Advertisements

6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks (Continuation). 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 12: Deadlocks (Chapter 7)
Chapter 7 Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks 7.1 System Model.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 30 Handling Deadlock.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
Deadlock CSCI 444/544 Operating Systems Fall 2008.
03/07/2007CSCI 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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne  Operating System Concepts Deadlock and Starvation Deadlock – two or more processes are waiting indefinitely for.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 7: Deadlocks.
CSE 451: Operating Systems Winter 2011 Deadlock Mark Zbikowski Gary Kimura.
CSE 451: Operating Systems Spring 2013 Module 9 Deadlock Ed Lazowska Allen Center 570 © 2013 Gribble, Lazowska, Levy, Zahorjan.
IT 344: Operating Systems Winter 2010 Module 8 Deadlock Chia-Chi Teng CTB 265.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Objectives Understand the Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Deadlocks.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling 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.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance 3.6. Deadlock prevention.
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks System Model Deadlock Characterization Methods.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Chapter 7: Deadlocks Joe McCarthy CSS 430: Operating Systems - Deadlocks1.
Operating Systems Unit VI Deadlocks and Protection Department of Computer Science Engineering and Information Technology.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
IT 344: Operating Systems Module 8 Deadlock Chia-Chi Teng CTB 265.
Deadlock. Stepping on each other’s feet - I Thread T 1 b1:= allocate(); b2:= allocate(); …… release(b1); release(b2); Thread T 2 b1:= allocate(); b2:=
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
Chapter 10 Deadlock. What is Deadlock? Two or more entities need a resource to make progress, but will never get that resource Examples from everyday.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
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 451: Operating Systems Spring 2010 Module 9 Deadlock John Zahorjan Allen Center 534.
Deadlock CSE451 Andrew Whitaker. Review: What Can Go Wrong With Threads? Safety hazards  “Program does the wrong thing” Liveness hazards  “Program never.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
CSE 120 Principles of Operating
CSE 451: Operating Systems Winter 2014 Module 9 Deadlock
CSE 451: Operating Systems Winter 2012 Deadlock
CS703 - Advanced Operating Systems
Chapter 7: Deadlocks Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Introduction to Operating Systems
Deadlock, Illustrated.
CSE 451: Operating Systems Winter 2007 Module 8 Deadlock
CSE 451: Operating Systems Spring 2006 Module 8 Deadlock
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.
CSE 451: Operating Systems Autumn 2009 Module 9 Deadlock
CSE 451: Operating Systems Spring 2005 Module 8 Deadlock
CSE 451: Operating Systems Autumn 2010 Module 9 Deadlock
CSE 451: Operating Systems Winter 2007 Module 8 Deadlock
OPERATING SYSTEMS DEADLOCKS.
CSE 451: Operating Systems Spring 2008 Module 9 Deadlock
CSE 380 Lecture Note 12 Insup Lee
CENG334 Introduction to Operating Systems
CSE 451: Operating Systems Winter 2006 Module 8 Deadlock
Presentation transcript:

CSE 451: Operating Systems Winter 2004 Module 8 Deadlock Ed Lazowska lazowska@cs.washington.edu Allen Center 570 1

© 2004 Ed Lazowska & Hank Levy (Is Google the greatest, or what?) 5/9/2019 © 2004 Ed Lazowska & Hank Levy

© 2004 Ed Lazowska & Hank Levy Definition A thread is deadlocked when it’s waiting for an event that can never occur I’m waiting for you to clear the intersection, so I can proceed but you can’t move until he moves, and he can’t move until she moves, and she can’t move until I move thread A is in critical section 1, waiting for access to critical section 2; thread B is in critical section 2, waiting for access to critical section 1 I’m trying to book a vacation package to Tahiti – air transportation, ground transportation, hotel, side-trips. It’s all-or-nothing – one high-level transaction – with the four databases locked in that order. You’re trying to do the same thing in the opposite order. 5/9/2019 © 2004 Ed Lazowska & Hank Levy

© 2004 Ed Lazowska & Hank Levy Resource graph A deadlock exists if there is an irreducible cycle in the resource graph (such as the one above) 5/9/2019 © 2004 Ed Lazowska & Hank Levy

© 2004 Ed Lazowska & Hank Levy Graph reduction A graph can be reduced by a thread if all of that thread’s requests can be granted in this case, the thread terminates – all resources are freed – all arcs (allocations) to it in the graph are deleted Miscellaneous theorems (Holt, Havender): There are no deadlocked threads iff the graph is completely reducible The order of reductions is irrelevant (Detail: resources with multiple units) 5/9/2019 © 2004 Ed Lazowska & Hank Levy

Resource allocation graph with no cycle What would cause a deadlock? 5/9/2019 © 2004 Ed Lazowska & Hank Levy Silberschatz, Galvin and Gagne 2002

Resource allocation graph with a deadlock 5/9/2019 © 2004 Ed Lazowska & Hank Levy Silberschatz, Galvin and Gagne 2002

Resource allocation graph with a cycle but no deadlock 5/9/2019 © 2004 Ed Lazowska & Hank Levy Silberschatz, Galvin and Gagne 2002

Approaches to deadlock Prevention – don’t let deadlock occur each thread obtains all resources at the beginning; blocks until all are available drawback? resources are numbered; each thread obtains them in sequence (which means acquiring some before they are actually needed) why does this work? pros and cons? each thread states its maximum claim for every resource type; system runs the Banker’s algorithm at each allocation request if I were to allocate you that resource, and then everyone were to request their maximum claim for every resource, would there be a deadlock? how do I tell if there would be a deadlock? example: a hammer and five screwdrivers 5/9/2019 © 2004 Ed Lazowska & Hank Levy

© 2004 Ed Lazowska & Hank Levy Approaches (cont’d.) Detection and correction every once in a while, check to see if there’s a deadlock how? if so, eliminate it 5/9/2019 © 2004 Ed Lazowska & Hank Levy