Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.

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.
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.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Chapter 6 Concurrency: Deadlock and Starvation I
Avishai Wool lecture Introduction to Systems Programming Lecture 5 Deadlocks.
Chapter 6 Concurrency: Deadlock and Starvation
Concurrency: Deadlock and Starvation Chapter 6. Revision Describe three necessary conditions for deadlock Which condition is the result of the three necessary.
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.
1 Lecture 8: Deadlocks Operating System Spring 2008.
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.
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.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
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.
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.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
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);
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Chapter 7: Deadlocks.
Concurrency: Deadlock and Starvation
ITEC 202 Operating Systems
Chapter 12: Concurrency, Deadlock and Starvation
Deadlock B.Ramamurthy CSE421 9/17/2018 B.Ramamurthy.
Advanced Operating System Fall 2009
Chapter 7 Deadlock.
Chapter 7: Deadlocks.
DPNM Lab. Dept. of CSE, POSTECH
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlocks Session - 13.
DEADLOCK.
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Operating System 6 CONCURRENCY: MUTUAL EXCLUSION AND SYNCHRONIZATION
Deadlock B.Ramamurthy CSE421 4/26/2019 B.Ramamurthy.
Introduction to Deadlocks
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
CSE 542: Operating Systems
Presentation transcript:

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

Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting needs for resources by two or more processes

Deadlock in Traffic

Non-deadlock - Joint Progress Diagram

Deadlock in a Computer – Fatal Region

Deadlock Definition Formal definition : A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause. Usually the event is release of a currently held resource None of the processes can … – run – release resources – be awakened

How Deadlock Can Occur

Example of Deadlock Deadlock occurs if Receive is blocking P1... Receive(P2); Send(P2, M1); P2... Receive(P1); Send(P1, M2);

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

Conditions for Deadlock (ctd.) No preemption –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

Deadlock Prevention Mutual Exclusion –Spooling Hold and Wait –Require that a process request all of its required resources at one time –Requests would be granted/denied simultaneously

Deadlock Prevention (cont.) No Preemption –Process must release resource and request again –OS may preempt a process and require it to release its resources Circular Wait –Define a linear ordering of resources –Require that processes request resources according to the ordering

Deadlock Avoidance 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

Two Approaches to Deadlock Avoidance Do not start a process if its demands might lead to deadlock Do not grant an incremental resource request to a process if this allocation might lead to deadlock

Resource Allocation Denial Referred to as the Banker’s Algorithm State of the system is the current allocation of resources to process Safe state is where there is at least one sequence of execution of processes that does not result in deadlock Unsafe state is a state that is not safe

Determination of a Safe State

Determination of an Unsafe State

Deadlock Avoidance Logic

Deadlock Avoidance Maximum resource requirement must be stated in advance Processes under consideration must be independent; no synchronization (order of execution) requirements No process may exit/block while holding resources

Deadlock Detection

Strategies Once Deadlock Detected Abort all deadlocked processes Back up each deadlocked process to some previously defined checkpoint, and restart all process - original deadlock may re-occur Successively abort deadlocked processes until deadlock no longer exists Successively preempt resources until deadlock no longer exists

Dining Philosophers Problem

Dining Philosophers Problem with Semaphores

Dining Philosophers Problem with Monitor

UNIX Concurrency Mechanisms Pipes: circular buffer for two processes like in producer-consumer Messages: blocking receive Shared memory: shared pages – mutual exclusion is not guaranteed Semaphores Signals

Linux Kernel Concurrency Mechanism Includes all the mechanisms found in UNIX Atomic operations execute without interruption and without interference (by blocking the memory bus)

Linux Atomic Operations arithmetic operation plus setting condition code spinlocks for mutual exclusion (loop until lock acquired) traditional and readers-writer semaphores memory barrier operations: limit compiler or CPU in re-ordering instructions