Chapter 7 – Deadlock and Indefinite Postponement

Slides:



Advertisements
Similar presentations
Deadlock Prevention, Avoidance, and Detection
Advertisements

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.
Synchronization Algorithms and Concurrent Programming
Lecture 7: Deadlock     Necessary Conditions for Deadlock     Deadlock Prevention - Havender's Linear Ordering Deadlock Avoidance Deadlock Detection &
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
Ceng Operating Systems Chapter 2.4 : Deadlocks Process concept  Process scheduling  Interprocess communication  Deadlocks Threads.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 7 – Deadlock and Indefinite Postponement Outline 7.1 Introduction 7.2Examples of Deadlock.
7.4 Resource Concepts Preemptible resources (e.g. processors and main memory) –Can be removed from a process without loss of work Nonpreemptible resources.
Deadlocks Andy Wang Operating Systems COP 4610 / CGS 5765.
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.
Starvation and Deadlock
DPNM Lab. Dept. of CSE, POSTECH
The Banker’s Algorithm for A Single Resource
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
CS 450 OPERATING SYSTEMS DEADLOCKS Manju Muralidharan Priya.
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: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Bridge Crossing Example Traffic only in one direction. Each section.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Deadlocks Resources Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
Deadlock Questions answered in this lecture: What are the four necessary conditions for deadlock? How can deadlock be prevented? How can deadlock be avoided?
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.
Operating Systems 软件学院 高海昌 Operating Systems Gao Haichang, Software School, Xidian University 22 Contents  1. Introduction** 
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Operating Systems (OS)
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
CIS Operating Systems Deadlock Professor Qiang Zeng Fall 2015.
Deadlock cs550 Operating Systems David Monismith.
Chapter 7 Deadlocks. 7.1 Introduction Deadlock Common approaches to deal with deadlock – Prevention – Avoidance – Detection and recovery.
Deadlock Conditions for Deadlock Deadlock Prevention Deadlock Detection Deadlock Recovery Dining Philosophers Semaphores.
Deadlocks Mark Stanovich Operating Systems COP 4610.
Chapter 5 Process Management Semester 2. Objectives  What is a deadlock?  Seven cases of deadlocks  Conditions of deadlocks –Mutual exclusion.
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 Copyright ©: University of Illinois CS 241 Staff1.
Operating System Concepts and Techniques Lecture 16 Deadlock and starvation-2 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques,
Slide 10-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 10.
Operating Systems Unit 4: – Dining Philosophers – Deadlock – Indefinite postponement Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
Deadlocks CPE Operating Systems
Deadlock Operating Systems (CC2011NI) -Mr. Pranoy Man Pradhan.
Sistem Operasi IKH311 Deadlock. 2 Resources Examples of computer resources printers tape drives tables Processes need access to resources in reasonable.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 7 – Deadlock and Indefinite Postponement
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.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Conditions for Deadlock
Andy Wang Operating Systems COP 4610 / CGS 5765
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Operating System 6 CONCURRENCY: MUTUAL EXCLUSION AND SYNCHRONIZATION
Introduction to Deadlocks
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Presentation transcript:

Chapter 7 – Deadlock and Indefinite Postponement Outline 7.1 Introduction 7.2 Examples of Deadlock 7.2.1 Traffic Deadlock 7.2.2 Simple Resource Deadlock 7.2.3 Deadlock in Spooling Systems 7.2.4 Example: Dining Philosophers 7.3 Related Problem: Indefinite Postponement 7.4 Resource Concepts 7.5 Four Necessary Conditions for Deadlock 7.6 Deadlock Solutions 7.7 Deadlock Prevention 7.7.1 Denying the “Wait-For” Condition 7.7.2 Denying the “No-Preemption Condition 7.7.3 Denying the “Circular-Wait” Condition

Chapter 7 – Deadlock and Indefinite Postponement Outline (continued) 7.8 Deadlock Avoidance with Dijkstra’s Banker’s Algorithm 7.8.1 Example of a Safe State 7.8.2 Example of an Unsafe State 7.8.3 Example of Safe-State-to-Unsafe-State Transition 7.8.4 Banker’s Algorithm Resource Allocation 7.8.5 Weaknesses in the Banker’s Algorithm 7.9 Deadlock Detection 7.9.1 Resource-Allocation Graphs 7.9.2 Reduction of Resource-Allocation Graphs 7.10 Deadlock Recovery 7.11 Deadlock Strategies in Current and Future Systems

Objectives After reading this chapter, you should understand: the problem of deadlock. the four necessary conditions for deadlock to exist. the problem of indefinite postponement. the notions of deadlock prevention, avoidance, detection and recovery. algorithms for deadlock avoidance and detection. how systems can recover from deadlocks.

7.1 Introduction Deadlock A process or thread is waiting for a particular event that will not occur System deadlock One or more processes are deadlocked

7.2.2 Simple Resource Deadlock Figure 7.2 Resource deadlock example. This system is deadlocked because each process holds a resource being requested by the other process and neither process is willing to release the resource it holds.

True/False ___ Most deadlocks develop because of the normal contention for dedicated resources ___ Circular wait is characteristic of deadlocked systems ___ Spooling systems are prone to deadlock

7.2.4 Example: Dining Philosophers Problem statement: Five philosophers sit around a circular table. Each leads a simple life alternating between thinking and eating spaghetti. In front of each philosopher is a dish of spaghetti that is constantly replenished by a dedicated wait staff. There are exactly five forks on the table, one between each adjacent pair of philosophers. Eating spaghetti (in the most proper manner) requires that a philosopher use both adjacent forks (simultaneously). Develop a concurrent program free of deadlock and indefinite postponement that models the activities of the philosophers.

7.2.4 Example: Dining Philosophers Constraints: To prevent philosophers from starving: Free of deadlock Free of indefinite postponement Enforce mutual exclusion Two philosophers cannot use the same fork at once The problems of mutual exclusion, deadlock and indefinite postponement lie in the implementation of method eat.

7.2.4 Example: Dining Philosophers Figure 7.3 Dining philosopher behavior.

7.3 Related Problem: Indefinite Postponement Also called indefinite blocking or starvation Occurs due to biases in a system’s resource scheduling policies Aging Technique that prevents indefinite postponement by increasing process’s priority as it waits for resource