CSI 400/500 Operating Systems Spring 2009 Lecture #17 –Deadlocks Wednesday, April 15 th.

Slides:



Advertisements
Similar presentations
1 Concurrency: Deadlock and Starvation Chapter 6.
Advertisements

1 Concurrency: Deadlock and Starvation Chapter 6.
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.
1 Concurrency: Deadlock and Starvation Chapter 6.
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.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
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.
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 6 Concurrency: Deadlock and Starvation
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
Chapter 6 Concurrency: Deadlock and Starvation I
Chapter 6 Concurrency: Deadlock and Starvation
Deadlock CSCI 444/544 Operating Systems Fall 2008.
Concurrency: Deadlock & Starvation
CS 450 OPERATING SYSTEMS DEADLOCKS Manju Muralidharan Priya.
1 Lecture 8: Deadlocks Operating System Spring 2008.
1 M. Bozyigit ICS Operating Systems Deadlock. 2 Deadlock n Permanent blocking of a set of processes that either compete for system resources or communicate.
OS Spring 2004 Concurrency: Principles of Deadlock Operating Systems Spring 2004.
Witawas Srisa-an Chapter 6
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
02/19/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 6 Concurrency: Deadlock and Starvation
7: Deadlocks1 DEADLOCKS EXAMPLES: "It takes money to make money". You can't get a job without experience; you can't get experience without a job. BACKGROUND:
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
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 System Chapter 6. Concurrency: Deadlock and Starvation Lynn Choi School of Electrical Engineering.
CIS Operating Systems Deadlock Professor Qiang Zeng Fall 2015.
Deadlock Operating Systems: Internals and Design Principles.
Deadlocks. Deadlock handling Deadlock prevention Deadlock avoidance Deadlock detection Deadlock recovery.
Operating Systems Lecture 4 Deadlock Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software Engineering.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Chapter 5 Process Management Semester 2. Objectives  What is a deadlock?  Seven cases of deadlocks  Conditions of deadlocks –Mutual exclusion.
Informationsteknologi Monday, October 1, 2007Computer Systems/Operating Systems - Class 111 Today’s class Deadlock.
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.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Deadlock and Starvation
Concurrency: Deadlock and Starvation
ITEC 202 Operating Systems
Deadlock and Starvation
Deadlock and Starvation
Chapter 12: Concurrency, Deadlock and Starvation
Deadlock B.Ramamurthy CSE421 9/17/2018 B.Ramamurthy.
Chapter 7 Deadlock.
Deadlock B.Ramamurthy CSE421 1/11/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 2/23/2019 B.Ramamurthy.
DEADLOCK.
Deadlock B.Ramamurthy CSE421 4/23/2019 B.Ramamurthy.
Operating System 6 CONCURRENCY: MUTUAL EXCLUSION AND SYNCHRONIZATION
Deadlock B.Ramamurthy CSE421 4/26/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 5/1/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 8/28/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 9/3/2019 B.Ramamurthy.
Presentation transcript:

CSI 400/500 Operating Systems Spring 2009 Lecture #17 –Deadlocks Wednesday, April 15 th

2 Deadlock is... Permanent blocking of at least two processes competing for system resources One process waiting on release of resource held by another, who is waiting for different resource held by waiting process

3 Resource Types Reusable Process holds resource and then releases for later reuse by other processes Process holds resource and then releases for later reuse by other processes Examples: buffer, processors, memory, data devices Examples: buffer, processors, memory, data devicesConsumable Process creates and destroys resource Process creates and destroys resource Example: message blocks Example: message blocks

4 Conditions for Deadlock Mutual Exclusivity : only one process holds resource at a time Hold and wait : processes allowed to hold resources while waiting Non-preemptive processes Circular wait : processes in wait hold resources requested by hold resources requested byothers

5 Simple Solution Each process releases resource before requesting another Not always possible Data integrity of referenced Data integrity of referencedresource Dependent data or resources Dependent data or resources

6 Determining Deadlock Likelihood Resource Allocation Graph Shows processes, resources, and who holds or requests resources. Shows processes, resources, and who holds or requests resources. Rectangle is resource, circle is process Arrow from resource to process denotes hold Arrow from resource to process denotes hold Arrow from process to resource denotes request Arrow from process to resource denotes request  

7 Relieving Deadlock at Resource Level Multiple images Some resources (like database tables) allow multiple images, so that multiple processes can use it Some resources (like database tables) allow multiple images, so that multiple processes can use it Only works for read access Only works for read access Multiple read locks possible, only one write lock Demonstrated on Resource Allocation Graph by multiple dots Demonstrated on Resource Allocation Graph by multiple dots Read often denoted by solid arrowhead and dot, while write with open Read often denoted by solid arrowhead and dot, while write with open

8 Preventing Deadlock Total request Process requests all resources needed before proceeding Process requests all resources needed before proceeding Prevents Hold and Wait condition Prevents Hold and Wait condition Could starve resource heavy processes Could starve resource heavy processes

9 Preventing Deadlock, cont Single Write Lock Allow a process to hold only one Allow a process to hold only one write lock Prevents Hold and Wait Prevents Hold and Wait Could cause excessive wait if process holding write lock holds it for long time Could cause excessive wait if process holding write lock holds it for long timePreemption Insisting all process can be preempted Insisting all process can be preempted Only practical for resources easily saved and restored, like processors Only practical for resources easily saved and restored, like processors

10 Preventing Deadlock, cont Resource Ordering Resources of similar type must be allocated in order Resources of similar type must be allocated in order Release all existing locks to cycle back to beginning Release all existing locks to cycle back to beginning Prevents circular wait Prevents circular wait

11 Deadlock Avoidance Doesn’t restrict processes or resources Analyzes situations to prevent the simultaneous occurrence of all conditions Two methods: Process Denial Process Denial Resource Allocation Denial Resource Allocation Denial

12 Process Denial Works with resource claims Processes have maximum resource claim No process granted resources that exceed original claim No process set to Ready if their maximum resource claim + resource claim of processes in system exceeds maximum resource allocation

13 Pitfalls Assumes processes will request maximum resources at same time Prevents initiation of many processes

14 Resource Allocation Denial Deny resources to processes who could cause deadlock Expands Allocation and Claim numbers from Process Denial, but allows processes to begin Works with Remaining and Available resource vectors Processes through safe state until unsafe state detected

15 Deadlock Detection Check each resource request Demands that a request set maintained Request set lists processes with outstanding requests for resources When circular wait discovered, determine deadlocked resource and suspend active process

16 Integrated Strategy Group resources into classes Use linear ordering Maintain at least request and allocation matrices, if not maximum claim matrix