Concurrency Issues. Past lectures: What about coordinated access across multiple objects? Today s lecture:

Size: px
Start display at page:

Download "Concurrency Issues. Past lectures: What about coordinated access across multiple objects? Today s lecture:"

Transcription

1 Deadlock 1

2 Concurrency Issues Past lectures: Ø Problem: Safely coordinate access to shared resource Ø Solutions: Use semaphores, monitors, locks, condition variables Coordinate access within shared objects What about coordinated access across multiple objects? Ø If you are not careful, it can lead to deadlock Today s lecture: Ø What is deadlock? Ø How can we address deadlock? 2

3 Deadlocks Motivating Examples Two producer processes share a buffer but use a different protocol for accessing the buffers Producer1() { P(emptyBuffer) P(producerMutexLock) : } Producer2(){ P(producerMutexLock) P(emptyBuffer) : } A postscript interpreter and a visualization program compete for memory frames PS_Interpreter() { request(memory_frames, 10) <process file> request(frame_buffer, 1) <draw file on screen> } Visualize() { request(frame_buffer, 1) <display data> request(memory_frames, 20) <update display> } 3

4 Deadlock Definition Head Ready Running Tail ready queue Waiting Head Tail semaphore/ condition queues A set of processes is deadlocked when every process in the set is waiting for an event that can only be generated by some process in the set Starvation vs. deadlock Ø Starvation: threads wait indefinitely (e.g., because some other thread is using a resource) Ø Deadlock: circular waiting for resources Ø Deadlock è starvation, but not the other way 4

5 A Graph Theoretic Model of Deadlock The resource allocation graph (RAG) Basic components of any resource allocation problem Ø Processes and resources Model the state of a computer system as a directed graph Ø G = (V, E) Ø V = the set of vertices = {P 1,..., P n } {R 1,..., R m } P i R j Ø E = the set of edges = {edges from a resource to a process} {edges from a process to a resource} P i request edge R j allocation edge P k 5

6 Resource Allocation Graphs Examples A PostScript interpreter that is waiting for the frame buffer lock and a visualization process that is waiting for memory V = {PS interpret, visualization} {memory frames, frame buffer lock} Visualization Process Memory Frames PostScript Interpreter Frame Buffer 6

7 A Graph Theoretic Model of Deadlock Resource allocation graphs & deadlock Theorem: If a resource allocation graph does not contain a cycle then no processes are deadlocked A cycle in a RAG is a necessary condition for deadlock Is the existence of a cycle a sufficient condition? Game Visualization Process Memory Frames PostScript Interpreter Frame Buffer 7

8 A Graph Theoretic Model of Deadlock Resource allocation graphs & deadlock Theorem: If there is only a single unit of all resources then a set of processes are deadlocked iff there is a cycle in the resource allocation graph Memory Frames Visualization Process PostScript Interpreter Frame Buffer 8

9 Using the Theory An operational definition of deadlock Visualization Process Memory Frames PostScript Interpreter Frame Buffer A set of processes are deadlocked iff the following conditions hold simultaneously 1. Mutual exclusion is required for resource usage (serially useable) 2. A process is in a hold-and-wait state 3. Preemption of resource usage is not allowed 4. Circular waiting exists (a cycle exists in the RAG) 9

10 Dealing With Deadlock Deadlock prevention & avoidance Adopt some resource allocation protocol that ensures deadlock can never occur Ø Deadlock prevention/avoidance Guarantee that deadlock will never occur Generally breaks one of the following conditions: Mutex Hold-and-wait No preemption Circular wait *This is usually the weak link* Ø Deadlock detection and recovery Admit the possibility of deadlock occurring and periodically check for it On detecting deadlock, abort Breaks the no-preemption condition What does the RAG for a lock look like? 10

11 Deadlock Avoidance Resource Ordering Recall this situation. How can we avoid it? Producer1() { P(emptyBuffer) P(producerMutexLock) : } Producer2(){ P(producerMutexLock) P(emptyBuffer) : } Eliminate circular waiting by ordering all locks (or semaphores, or resoruces). All code grabs locks in a predefined order. Problems? Ø Maintaining global order is difficult, especially in a large project. Ø Global order can force a client to grab a lock earlier than it would like, tying up a resource for too long. Ø Deadlock is a global property, but lock manipulation is local. 11

12 Deadlock Detection & Recovery Recovering from deadlock R 1 R 2 R 3 R 4 P 1 P 2 P 3 P 4 P 5 Abort all deadlocked processes & reclaim their resources Abort one process at a time until all cycles in the RAG are eliminated Where to start? Ø Select low priority process Ø Processes with most allocation of resources Caveat: ensure that system is in consistent state (e.g., transactions) Optimization: Ø Checkpoint processes periodically; rollback processes to checkpointed state 12

13 Dealing With Deadlock Deadlock avoidance Banker s Algorithm Examine each resource request and determine whether or not granting the request can lead to deadlock Define a set of vectors and matrices that characterize the current state of all resources and processes Ø resource allocation state matrix Alloc ij = the number of units of resource j held by process i Ø maximum claim matrix Max ij = the maximum number of units of resource j that the process i will ever require simultaneously Ø available vector Avail j = the number of units of resource j that are unallocated P 1 P 2 P 3... P p R 1 R 2 R 3... R r n 1,1 n 1,2 n 1,3... n 1,r n 2,1 n 2,2 n 3,1... n p, n p,r <n 1, n 2, n 3,..., n r > 13

14 Dealing With Deadlock Deadlock detection & recovery What are some problems with the banker s algorithm? Ø Very slow O(n 2 m) Ø Too slow to run on every allocation. What else can we do? Deadlock prevention and avoidance: Ø Develop and use resource allocation mechanisms and protocols that prohibit deadlock Deadlock detection and recovery: Ø Let the system deadlock and then deal with it Detect that a set of processes are deadlocked Recover from the deadlock 14

DUH! Deadlocks. Concurrency Issues. The TENEX Case. If a process requests all systems buffers, operator console tries to print an error message

DUH! Deadlocks. Concurrency Issues. The TENEX Case. If a process requests all systems buffers, operator console tries to print an error message 1 Concurrency Issues Past lectures: Problem: Safely coordinate access to shared resource Solutions: Use semaphores, monitors, locks, condition variables Coordinate access within shared objects Deadlocks

More information

CSE 306/506 Operating Systems Deadlock. YoungMin Kwon

CSE 306/506 Operating Systems Deadlock. YoungMin Kwon CSE 306/506 Operating Systems Deadlock YoungMin Kwon Deadlock A set of processes are deadlocked if Each process in the set is blocked and Waiting for an event that can be triggered only from another process

More information

Deadlock Revisited. CS439: Principles of Computer Systems November 29, 2017

Deadlock Revisited. CS439: Principles of Computer Systems November 29, 2017 Deadlock Revisited CS439: Principles of Computer Systems November 29, 2017 Last Time Distributed File Systems Remote Procedure Calls (RPC) Consistency Models Coherence, Staleness, Consistency Network File

More information

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting

More information

Last Class: Monitors. Real-world Examples

Last Class: Monitors. Real-world Examples Last Class: Monitors Monitor wraps operations with a mutex Condition variables release mutex temporarily C++ does not provide a monitor construct, but monitors can be implemented by following the monitor

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Chapter 8: Deadlocks. Bridge Crossing Example. The Deadlock Problem

Chapter 8: Deadlocks. Bridge Crossing Example. The Deadlock Problem Chapter 8: Deadlocks Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 8.1 Bridge Crossing Example Bridge has one

More information

Deadlocks. Dr. Yingwu Zhu

Deadlocks. Dr. Yingwu Zhu Deadlocks Dr. Yingwu Zhu Deadlocks Synchronization is a live gun we can easily shoot ourselves in the foot Incorrect use of synchronization can block all processes You have likely been intuitively avoiding

More information

CSE 380 Computer Operating Systems

CSE 380 Computer Operating Systems CSE 380 Computer Operating Systems Instructor: Insup Lee and Dianna Xu University of Pennsylvania, Fall 2003 Lecture Note: Deadlocks 1 Resource Allocation q Examples of computer resources printers tape

More information

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem? What is the Race Condition? And what is its solution? Race Condition: Where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

ECE519 Advanced Operating Systems

ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (6 th Week) (Advanced) Operating Systems 6. Concurrency: Deadlock and Starvation 6. Outline Principles of Deadlock

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Chapter

More information

Deadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1

Deadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Deadlock Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Recap: Synchronization Race condition A situation when two or more threads read and write shared

More information

Bridge Crossing Example

Bridge Crossing Example CSCI 4401 Principles of Operating Systems I Deadlocks Vassil Roussev vassil@cs.uno.edu Bridge Crossing Example 2 Traffic only in one direction. Each section of a bridge can be viewed as a resource. If

More information

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne 1 DEADLOCKS In a multi programming environment, several processes

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks Chapter 7: Deadlocks 7.1 System Model 7.2 Deadlock Characterization 7.3 Methods for Handling Deadlocks 7.4 Deadlock Prevention 7.5 Deadlock Avoidance 7.6 Deadlock Detection 7.7 Recovery

More information

Operating Systems. Deadlock. User OS. Kernel & Device Drivers. Interface Programs. Brian Mitchell - Operating Systems

Operating Systems. Deadlock. User OS. Kernel & Device Drivers. Interface Programs. Brian Mitchell - Operating Systems User OS Kernel & Device Drivers Interface Programs Deadlock 1 Deadlocks Computer resources are full of resources that can only be used by one process at a time Unpredictable results can occur if two or

More information

Deadlock Revisited. CS439: Principles of Computer Systems April 23, 2018

Deadlock Revisited. CS439: Principles of Computer Systems April 23, 2018 Deadlock Revisited CS439: Principles of Computer Systems April 23, 2018 Last Time Distributed File Systems Remote Procedure Calls (RPC) Consistency Models Coherence, Staleness, Consistency Network File

More information

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks Zhi Wang Florida State University Contents Deadlock problem System model Handling deadlocks deadlock prevention deadlock avoidance

More information

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition Chapter 7: Deadlocks 7.1 Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock

More information

Deadlocks. Mehdi Kargahi School of ECE University of Tehran Spring 2008

Deadlocks. Mehdi Kargahi School of ECE University of Tehran Spring 2008 Deadlocks Mehdi Kargahi School of ECE University of Tehran Spring 2008 What is a Deadlock Processes use resources in the following sequence: Request Use Release A number of processes may participate in

More information

The Deadlock Problem

The Deadlock Problem The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P 1 and P 2 each hold one

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example Concepts to discuss Deadlock CSCI 315 Operating Systems Design Department of Computer Science Deadlock Livelock Spinlock vs. Blocking Notice: The slides for this lecture have been largely based on those

More information

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Deadlock The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example semaphores A and B, initialized to 1 P 0 P

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition, Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

! What is a deadlock? ! What causes a deadlock? ! How do you deal with (potential) deadlocks? Maria Hybinette, UGA

! What is a deadlock? ! What causes a deadlock? ! How do you deal with (potential) deadlocks? Maria Hybinette, UGA Chapter 8: Deadlock Questions? CSCI 4730 Operating Systems! What is a deadlock?! What causes a deadlock?! How do you deal with (potential) deadlocks? Deadlock Deadlock: What is a deadlock? Example: Two

More information

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices! " Silberschatz, Galvin and Gagne 2013!

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices!  Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter

More information

Chapter 3. Deadlocks

Chapter 3. Deadlocks Chapter 3 Deadlocks 3.1 Resource 3.2 Introduction to deadlocks 3.3 The ostrich algorithm 3.4 Deadlock detection and recovery 3.5 Deadlock avoidance 3.6 Deadlock prevention 3.7 Other issues Resources Examples

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 16-17 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and

More information

Chapter 8: Deadlocks

Chapter 8: Deadlocks Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization Chapter 8: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Module 6: Deadlocks. Reading: Chapter 7

Module 6: Deadlocks. Reading: Chapter 7 Module 6: Deadlocks Reading: Chapter 7 Objective: To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods

More information

System Model. Types of resources Reusable Resources Consumable Resources

System Model. Types of resources Reusable Resources Consumable Resources Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock System Model Types

More information

Basics of Deadlock Theory. Deadlocks

Basics of Deadlock Theory. Deadlocks CMSC 621, Advanced Operating Systems. Fall 2003 Basics of Deadlock Theory Dr. Kalpakis Deadlocks deadlock occurs when there is a set of processes which have outstanding requests for resources that can

More information

Deadlock Risk Management

Deadlock Risk Management Lecture 5: Deadlocks, Deadlock Risk Management Contents The Concept of Deadlock Resource Allocation Graph Approaches to Handling Deadlocks Deadlock Avoidance Deadlock Detection Recovery from Deadlock AE3B33OSD

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from

More information

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model Module 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

The Deadlock Problem (1)

The Deadlock Problem (1) Deadlocks The Deadlock Problem (1) A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P 1 and P 2

More information

Chapter 7: Deadlocks CS370 Operating Systems

Chapter 7: Deadlocks CS370 Operating Systems Chapter 7: Deadlocks CS370 Operating Systems Objectives: Description of deadlocks, which prevent sets of concurrent processes from completing their tasks Different methods for preventing or avoiding deadlocks

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013!

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

CS307 Operating Systems Deadlocks

CS307 Operating Systems Deadlocks CS307 Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Bridge Crossing Example Traffic only in one direction Each section of a bridge can be viewed

More information

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model CS07 Bridge Crossing Example Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Traffic only in one direction Each section of a bridge can be viewed

More information

Resources. Lecture 4. Deadlocks. Resources (2) Resources (1) Four Conditions for Deadlock. Introduction to Deadlocks

Resources. Lecture 4. Deadlocks. Resources (2) Resources (1) Four Conditions for Deadlock. Introduction to Deadlocks Lecture 4 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance 3.6. Deadlock prevention 3.7. Other issues Resources

More information

Operating systems. Lecture 5. Deadlock: System Model. Deadlock: System Model. Process synchronization Deadlocks. Deadlock: System Model

Operating systems. Lecture 5. Deadlock: System Model. Deadlock: System Model. Process synchronization Deadlocks. Deadlock: System Model Lecture 5 Operating systems Process synchronization Deadlocks Deadlock: System Model Computer system: Processes (program in execution); Resources (CPU, memory space, files, I/O devices, on so on). Deadlock:

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition, Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009!

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling

More information

The Deadlock Problem

The Deadlock Problem Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock The Deadlock

More information

CSE Opera+ng System Principles

CSE Opera+ng System Principles CSE 30341 Opera+ng System Principles Deadlocks Overview System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock

More information

Deadlocks. Deadlock Overview

Deadlocks. Deadlock Overview Deadlocks Gordon College Stephen Brinton Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK

Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

CHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 7: DEADLOCKS By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention

More information

CISC 7310X. C10: Deadlocks. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/12/2018 CUNY Brooklyn College

CISC 7310X. C10: Deadlocks. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/12/2018 CUNY Brooklyn College CISC 7310X C10: Deadlocks Hui Chen Department of Computer & Information Science CUNY Brooklyn College 4/12/2018 CUNY Brooklyn College 1 Outline Concept of deadlock Necessary conditions Models of deadlocks

More information

Deadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources.

Deadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources. Deadlock Prevention Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources. Hold and Wait must guarantee that whenever a process

More information

Chapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14

Chapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14 Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter

More information

OPERATING SYSTEMS. Deadlocks

OPERATING SYSTEMS. Deadlocks OPERATING SYSTEMS CS3502 Spring 2018 Deadlocks Chapter 7 Resource Allocation and Deallocation When a process needs resources, it will normally follow the sequence: 1. Request a number of instances of one

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 11 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and course

More information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Chapter 6. Deadlock. (A Quick Introduction)

Chapter 6. Deadlock. (A Quick Introduction) Chapter 6 Deadlock (A Quick Introduction) 1 Resources and Deadlocks Processes need access to resources in order to make progress. Examples of Resources: Kernel Data Structures (ProcessControlBlocks, Threads,

More information

Deadlocks. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Deadlocks. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Deadlocks Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics What is deadlock? Deadlock characterization Four conditions for deadlock

More information

Concurrency: Deadlock and Starvation

Concurrency: Deadlock and Starvation Concurrency: Deadlock and Starvation Chapter 6 E&CE 354: Processes 1 Deadlock Deadlock = situation in which every process from a set is permanently blocked, i.e. cannot proceed with execution Common cause:

More information

!! What is a deadlock? !! What causes a deadlock? !! How do you deal with (potential) deadlocks? Maria Hybinette, UGA

!! What is a deadlock? !! What causes a deadlock? !! How do you deal with (potential) deadlocks? Maria Hybinette, UGA Chapter 8: Deadlock Questions? CSCI [4 6]730 Operating Systems!! What is a deadlock?!! What causes a deadlock?!! How do you deal with (potential) deadlocks? Deadlock 2 Deadlock: What is a deadlock? Example:

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Potential Deadlock Example

Potential Deadlock Example Deadlock Handling Notice: The slides for this lecture have been largely based on those accompanying an earlier edition of the course text Operating Systems Concepts, 9th ed., by Silberschatz, Galvin, and

More information

Concurrency: Deadlock and Starvation. Chapter 6

Concurrency: Deadlock and Starvation. Chapter 6 Concurrency: Deadlock and Starvation Chapter 6 1 What is Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involve conflicting needs

More information

Outlook. Deadlock Characterization Deadlock Prevention Deadlock Avoidance

Outlook. Deadlock Characterization Deadlock Prevention Deadlock Avoidance Deadlocks Outlook Deadlock Characterization Deadlock Prevention Deadlock Avoidance Deadlock Detection and Recovery e 2 Deadlock Characterization 3 Motivation System owns many resources of the types Memory,

More information

ECS 150 (Operating Systems) Goal To examine what causes deadlock, and what to do about it. Spring Quarter

ECS 150 (Operating Systems) Goal To examine what causes deadlock, and what to do about it. Spring Quarter D e a d l o c k Goal To examine what causes deadlock, and what to do about it. Spring Quarter 1999 1 The resource manager is that part of the kernel responsible for managing resources. Its process interface

More information

Concurrency: Deadlock and Starvation. Chapter 6

Concurrency: Deadlock and Starvation. Chapter 6 Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involve conflicting needs for resources

More information

Operating Systems. Deadlocks

Operating Systems. Deadlocks Operating Systems Deadlocks Deadlocks Example: two processes want to scan a document, and then save it on a CD P0 down(scanner); down(cd_writer); scan_and_record(); up(cd_writer); up(scanner); P1 down(cd_writer);

More information

TDDB68 + TDDD82. Lecture: Deadlocks

TDDB68 + TDDD82. Lecture: Deadlocks TDDB68 + TDDD82 Lecture: Deadlocks Mikael Asplund, Senior Lecturer Real-time Systems Laboratory Department of Computer and Information Science Thanks to Simin Nadjm-Tehrani and Christoph Kessler for much

More information

Resource Management and Deadlocks 1

Resource Management and Deadlocks 1 Resource Management and Deadlocks 1 The Deadlock Problem Law passed by the Kansas Legislature in early 20th century: When two trains approach each other at a crossing, both shall come to a full stop and

More information

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring A Bit More on Synchronization Deadlock CS 256/456 Dept. of Computer Science, University of Rochester Synchronizing interrupt handlers: Interrupt handlers run at highest priority and they must not block.

More information

Operating System: Chap7 Deadlocks. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap7 Deadlocks. National Tsing-Hua University 2016, Fall Semester Operating System: Chap7 Deadlocks National Tsing-Hua University 2016, Fall Semester Overview System Model Deadlock Characterization Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from

More information

UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock.

UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock. UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process

More information

When Deadlock Happens

When Deadlock Happens Deadlock Detection Notice: The slides for this lecture have been largely based on those accompanying an earlier edition of the course text Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Module 7: Deadlocks. The Deadlock Problem

Module 7: Deadlocks. The Deadlock Problem Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. System Model Deadlock Characterization Methods of handling

More information

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian ICS 143 - Principles of Operating Systems Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian nalini@ics.uci.edu Outline System Model Deadlock Characterization Methods for handling deadlocks Deadlock

More information

Operating Systems. Deadlock. Lecture 7 Michael O Boyle

Operating Systems. Deadlock. Lecture 7 Michael O Boyle Operating Systems Deadlock Lecture 7 Michael O Boyle 1 2 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

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Lecture 8: Deadlock Ryan Huang Administrivia Lab 1 deadline extended - Friday 09/29 11:59 pm - Saturday 09/30 11:59 pm [Hard] HW2 out - should try to solve

More information

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

CS420: Operating Systems. Deadlocks & Deadlock Prevention

CS420: Operating Systems. Deadlocks & Deadlock Prevention Deadlocks & Deadlock Prevention James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne The Deadlock Problem

More information

More on Synchronization and Deadlock

More on Synchronization and Deadlock Examples of OS Kernel Synchronization More on Synchronization and Deadlock Two processes making system calls to read/write on the same file, leading to possible race condition on the file system data structures

More information

6. Concurrency: Deadlock

6. Concurrency: Deadlock CSC400 - Operating Systems 6. Concurrency: Deadlock J. Sumey Deadlock one problem that results from multiprogramming def: a process (or thread) is said to be deadlocked if it is waiting for an event that

More information

Chapter 8: Deadlocks. Operating System Concepts with Java

Chapter 8: Deadlocks. Operating System Concepts with Java Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Chapter - 4. Deadlocks Important Questions

Chapter - 4. Deadlocks Important Questions Chapter - 4 Deadlocks Important Questions 1 1.What do you mean by Deadlocks? A process request for some resources. If the resources are not available at that time, the process enters a waiting state. The

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

CS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

CS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian 1 CS153: Deadlock Chengyu Song Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian 2 Administrivia Lab Lab1 is due this Sunday Demo sessions next week Little book of semaphores First

More information

Operating Systems: William Stallings. Starvation. Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall

Operating Systems: William Stallings. Starvation. Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 6 Concurrency: Deadlock and Starvation Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Deadlock

More information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph Chapter 8: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

CMSC 412. Announcements

CMSC 412. Announcements CMSC 412 Deadlock Reading Announcements Chapter 7 Midterm next Monday In class Will have a review on Wednesday Project 3 due Friday Project 4 will be posted the same day 1 1 The Deadlock Problem A set

More information

The Deadlock Problem

The Deadlock Problem Deadlocks The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P1 and P2 each

More information

Deadlocks. The Deadlock Problem. Bridge Crossing Example. Topics

Deadlocks. The Deadlock Problem. Bridge Crossing Example. Topics Deadlocks Topics - System Model - Deadlock characterization - Methods for handling deadlocks - Deadlock prevention,avoidance - Deadlock detection and recovery The Deadlock Problem - A set of blocked processes

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 17 Deadlock Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Claim edge may request- request

More information