Deadlock Operating Systems: Internals and Design Principles.

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.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
DEADLOCK. Contents  Principles of deadlock  Deadlock prevention  Deadlock detection.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation I
Chapter 6 Concurrency: Deadlock and Starvation
CSI 400/500 Operating Systems Spring 2009 Lecture #17 –Deadlocks Wednesday, April 15 th.
Modified from Silberschatz, Galvin and Gagne Lecture 13 Chapter 7: Deadlocks.
Deadlock CSCI 444/544 Operating Systems Fall 2008.
Concurrency: Deadlock & Starvation
The ‘deadlock’ conditions Reviewing some key points concerning the potential for ‘deadlock’ in an operating system.
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
Chapter 7.1: Deadlocks.
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 6 Concurrency: Deadlock and Starvation
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.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Operating System Chapter 6. Concurrency: Deadlock and Starvation Lynn Choi School of Electrical Engineering.
CIS Operating Systems Deadlock Professor Qiang Zeng Fall 2015.
This Time - Deadlock Definition Conditions for deadlocks
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Deadlocks.
Informationsteknologi Monday, October 1, 2007Computer Systems/Operating Systems - Class 111 Today’s class Deadlock.
DEADLOCKS Prepared By: Dr. Vipul Vekariya. D EADLOCK A set of processes is deadlocked when each process in the set is blocked awaiting an event that can.
Lecture 6 Deadlock 1. Deadlock and Starvation Let S and Q be two semaphores initialized to 1 P 0 P 1 wait (S); wait (Q); wait (Q); wait (S);. signal (S);
Deadlock Operating Systems (CC2011NI) -Mr. Pranoy Man Pradhan.
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
Operating systems Deadlocks.
ITEC 202 Operating Systems
Deadlock and Starvation
Chapter 12: Concurrency, Deadlock and Starvation
Deadlock B.Ramamurthy CSE421 9/17/2018 B.Ramamurthy.
Advanced Operating System Fall 2009
CHAPTER 6: Concurrency - Deadlock and Starvation
Chapter 7 Deadlock.
Chapter 7: Deadlocks.
Chapter 7: Deadlocks.
Operating systems Deadlocks.
Concurrency.
Deadlocks Session - 13.
DEADLOCK.
Operating System 6 CONCURRENCY: MUTUAL EXCLUSION AND SYNCHRONIZATION
Deadlock B.Ramamurthy CSE421 4/26/2019 B.Ramamurthy.
Presentation transcript:

Deadlock Operating Systems: Internals and Design Principles

The permanent blocking of a set of processes that either compete for system resources or communicate with each other A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set Permanent No efficient solution

Potential Deadlock I need quad A and B I need quad B and C I need quad C and D I need quad D and A

Actual Deadlock HALT until B is free HALT until C is free HALT until D is free HALT until A is free

In the previous example, the actual deadlock was not guaranteed to happen For example, if one of the cars decides to stop rather than enter the intersection, then the other three cars could cross through with no problem. Like race conditions, deadlock is a result of a particular sequence of execution steps that may occur infrequently or never

Reusable can be safely used by only one process at a time and is not depleted by that use processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores Consumable one that can be created (produced) and destroyed (consumed) interrupts, signals, messages, and information in I/O buffers Resources are fundamental to deadlock – competition to control them is the cause of the problem.

Reusable Resources Example

Example 2: Memory Request Space is available for allocation of 200Kbytes, and the following sequence of events occur: Deadlock occurs if both processes progress to their second request Competition for memory and CPU could cause deadlock, but modern operating systems manage these resources so it doesn’t happen. P1... Request 80 Kbytes ; Request 60 Kbytes; P2... Request 70 Kbytes ; Request 80 Kbytes;

Consider a pair of processes, in which each process attempts to receive a message from the other process and then send a message to the other process: Deadlock occurs if the Receive is blocking

Resource Allocation Graphs

Conditions for Deadlock Mutual Exclusion only one process may use a resource at a time Hold-and- Wait a process may hold allocated resources while awaiting assignment of others No Pre-emption no resource can be forcibly removed from a process holding it Circular Wait a closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain

Dealing with Deadlock Three general approaches exist for dealing with deadlock: adopt a policy that eliminates one of the conditions Prevent Deadlock make the appropriate dynamic choices based on the current state of resource allocation Avoid Deadlock attempt to detect the presence of deadlock and take action to recover Detect Deadlock

Design a system in such a way that the possibility of deadlock is excluded Two main methods: Indirect prevent the occurrence of one of the three necessary conditions Direct prevent the occurrence of a circular wait

Mutual Exclusion if access to a resource requires mutual exclusion then it must be supported by the OS Hold and Wait require that a process request all of its required resources at one time; block the process until all requests can be granted simultaneously

No Preemption if a process holding certain resources is denied a further request, that process must release its original resources and request them again OS may preempt a lower priority process and require it to release its resources Works for resources whose state can be saved, such as the CPU, but is not a good general solution

Circular Wait define a linear ordering of resource types – assume they are numbered 1, 2, …, n Require all processes to request their resources in order; for example: if process 1 already holds a resource from type 4, it may not request any resources from types 1, 2, or 3. If this condition is enforced there can never be a circular wait, although a normal wait is possible.

A decision is made dynamically whether the current resource allocation request will, if granted, potentially lead to a deadlock Requires knowledge of future process requests

Deadlock Avoidance Process Initiation Denial do not start a process if its demands might lead to deadlock Resource Allocation Denial do not grant an incremental resource request to a process if this allocation might lead to deadlock

Questions