The Echo Algorithm The echo algorithm can be used to collect and disperse information in a distributed system It was originally designed for learning network.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

1 Deadlock Deadlock is a situation where a process or a set of processes is blocked on an event that never occurs Processes while holding some resources.
Deadlock Prevention, Avoidance, and Detection
1 Distributed Deadlock Fall DS Deadlock Topics Prevention –Too expensive in time and network traffic in a distributed system Avoidance.
Deadlock and Starvation
Handling Deadlocks n definition, wait-for graphs n fundamental causes of deadlocks n resource allocation graphs and conditions for deadlock existence n.
Deadlock Prevention, Avoidance, and Detection.  The Deadlock problem The Deadlock problem  Conditions for deadlocks Conditions for deadlocks  Graph-theoretic.
Lecture 8: Asynchronous Network Algorithms
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
Chapter 7: Deadlocks.
7.5 Deadlock Avoidance The algorithm is simply to ensure that the system will always remain in safe state. Therefore, if a process requests a resource.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Global State Collection. Global state collection Some applications - computing network topology - termination detection - deadlock detection Chandy-Lamport.
Deadlocks CS 3100 Deadlocks1. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 7: Deadlock Dr. Mohamed Hefeeda.
What we will cover…  The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock.
CH 3 Deadlock When 2 (or more) processes remain blocked forever!
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Cosc 4740 Chapter 6, Part 4 Deadlocks. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-6 Deadlocks Department of Computer Science and Software Engineering.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Dr. Kalpakis CMSC 421, Operating Systems Deadlocks.
Hwajung Lee. Some applications - computing network topology - termination detection - deadlock detection Chandy Lamport algorithm does a partial job.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 7 Operating Systems.
CS307 Operating Systems Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
1 Chapter 11 Global Properties (Distributed Termination)
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
CH 3 Deadlock When 2 (or more) processes remain blocked forever!
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
ICS Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources 6.2 Approaches to the Deadlock Problem 6.3 A System Model –Resource Graphs –State.
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 7 Deadlocks 1. Objectives and Outline Outline The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock.
CSE Operating System Principles Deadlocks. CSE – Operating System Principles2 Overview System Model Deadlock Characterization Methods for.
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 7: Deadlocks. The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks.
OPERATING SYSTEM CONCEPTS AND PRACTISE
Chapter 7: Deadlocks.
Global state and snapshot
Termination detection
Synchronization: Distributed Deadlock Detection
Concurrency: Deadlock and Starvation
Global state and snapshot
G.Anuradha Ref:- Galvin
Garbage Collection Modern programming languages provide garbage collection mechanisms for reclaiming the memory locations that are no longer used by programs.
Lecture 9: Asynchronous Network Algorithms
Chapter 7: Deadlocks.
ITEC452 Distributed Computing Lecture 9 Global State Collection
Operating System: DEADLOCKS
Outline Distributed Mutual Exclusion Distributed Deadlock Detection
Chapter 7 Deadlocks.
Process Deadlocks.
G.Anuradha Ref:- Galvin
Chapter 7: Deadlocks.
Deadlocks Session - 14.
Global State Collection
Chapter 7: Deadlocks.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Deadlock Detection
Chapter 7: Deadlocks.
Chapter 8: Deadlocks Deadlock Characterization
Presentation transcript:

The Echo Algorithm The echo algorithm can be used to collect and disperse information in a distributed system It was originally designed for learning network topology. But, it can be applied for solving many other problems Each node only knows and communicates with its neighbours. 1 5 4 3 2 7 6 1

The initiator starts the algorithm by sending probes to all its neighbours. The algorithm terminates when the initiator receives echoes from all its neighbours. A non-initiator node replicates and sends probes to its neighbours after receiving a probe. A non-initiator node sends an echo to the node from which its receives the probe when the node has received probes from all its neighbours.

Deadlock detection in distributed systems System model A computation consists of a set of processes running on a collection of processors connected by a communication network Without loss of generality, it is assumed that each process runs on a different processor The processors do not share a common global memory and communicate solely by passing messages over the communication network Processes make exclusive access to resources and there is only one copy for each resource A process can be in two states, running or blocked A blocked process is waiting to acquire some resources

Wait-for graph A wait-for graph is a directed graph In a wait-for graph, nodes are processes There is a directed edge from node P1 to P2 if P1 is blocked and waiting for P2 to release some resources Example P1: w1[x] w1[y] P2: r2[y] r2[x] P1 P2

Models of Deadlock x y z There are two deadlock models AND model (resource model) OR model (communication model) In the AND model A process is permitted to request a set of resources. The process remains blocked until it is granted all the resources it has requested. Therefore, requests of this type are called AND requests. To find a deadlock in the AND model it is necessary to find a cycle in the wait-for graph. x y z 5

In the OR model A process can communicate with a set of other processes. The process can make progress as long as one of the communication occurs. Therefore, in this model a cycle in the wait-for graph does not necessary mean a deadlock exists To detect a deadlock it is necessary to detect a knot in the wait-for graph. All the processes being waited by other processes are in a cycle. A knot in a directed graph is a collection of vertices and edges with the property that every vertex in the knot has outgoing edges, and all outgoing edges from vertices in the knot terminate at other vertices in the knot. Thus it is impossible to leave the knot while following the directions of the edges. 6

B A C D

Deadlock Detection A deadlock detection algorithm must satisfy the following two conditions: the scheme does not detect a false deadlock all deadlocks will be detected Resolution of a detected deadlock Deadlock resolution involves breaking existing wait-for dependencies between the processes It involves rolling back one or several deadlocked processes and assigning their resources to blocked processes so that they can resume their execution 8

Distributed Scheme for AND model Designed for detecting the cycle which spans over several machines. The algorithm is invoked when a process starts waiting. A probe (i, j, k) is generated and sent to the process (or processes) holding the needed resources. i is the initiator of the probe, j is the sender, and, k is the receiver of the probe. 9

When the probe is received, the recipient checks to see if itself is waiting for any processes. If so, the probe is updated and sent to the processes being waited for. Otherwise, discard the probe. If the probe comes back to the original sender, a cycle exists and there is a deadlock in the system. 10

(0, 8, 0) 1 2 6 7 8 3 4 5 (0, 4, 6) (0, 5, 7) (0, 2, 3) 11

Distributed Scheme for OR model Based on the echo algorithm A blocked node passes probes along the edges in the wait-for graph A node only executes the algorithm (i.e. passes the probes or sends the echoes) if the node is blocked If the algorithm terminates, then every node in the wait-for graph is blocked. Deadlock 1 5 4 3 2 1 5 4 3 2 12

Review Describe the echo algorithm using pseudo code. Understand the deadlock detection schemes for the AND and OR model. Assume that we are running a computation that consists of several tasks. The tasks are distributed across the machines in a distributed system. Each task only knows the location of the tasks that it communicate with. Suppose we want to find out the CPU load information on each of the machines hosting the tasks. Outline an algorithm that finds the CPU load information from the machines that host the execution of the tasks. Suppose all the processes in the system has an distinct ID that can be used to uniquely identify the processes in the system. Modify Chandy’s deadlock detection for the AND model so that, when a deadlock is detected, the process with the smallest ID can be aborted to resolve the deadlock.

Further reading G. Andrews. Paradigms for process interaction in distributed programs. ACM Computing Surveys, 23(1):49--90, March 1991 (echo algorithm) K. Mani Chandy , Jayadev Misra , Laura M. Haas, Distributed deadlock detection, ACM Transactions on Computer Systems (TOCS), v.1 n.2, p.144-156, May 1983 (deadlock detection)