CCR Deadlock By: Laura Weiland April 30, 2002. Project Description Implement a module to the Train Operating System (TOS) that manages the deadlock problem.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

1 Concurrency: Deadlock and Starvation Chapter 6.
Deadlock Prevention, Avoidance, and Detection
ICS Principles of Operating Systems Lectures 8 and 9 - Deadlocks Prof. Dmitri V. Kalashnikov dvk ics.uci.edu Slides © Prof. Nalini Venkatasubramanian.
Deadlock and Starvation
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Deadlock Prevention, Avoidance, and Detection.  The Deadlock problem The Deadlock problem  Conditions for deadlocks Conditions for deadlocks  Graph-theoretic.
DEADLOCK. Contents  Principles of deadlock  Deadlock prevention  Deadlock detection.
Chapter 7: Deadlocks.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Operating Systems COMP 4850/CISG 5550 Deadlock Avoidance Dr. James Money.
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.
Chapter 7 Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks 7.1 System Model.
1 Wednesday, June 28, 2006 Command, n.: Statement presented by a human and accepted by a computer in such a manner as to make the human feel that he is.
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Deadlock CSCI 444/544 Operating Systems Fall 2008.
Chapter 6 Concurrency: Deadlock and Starvation
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
What we will cover…  The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock.
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:
Chapter 7 – Deadlock (Pgs 283 – 306). Overview  When a set of processes is prevented from completing because each is preventing the other from accessing.
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 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.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Signaling on the CCR Tyler Raulin. Overview of Signals Rules: – Red Light There is a train in the next section of track The turnout is not turned correctly.
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 Chapter 7: Deadlocks 7.1 System Model 7.2 Deadlock Characterization 7.3 Methods for Handling Deadlocks 7.4 Deadlock Prevention 7.5.
CS333 Intro to Operating Systems Jonathan Walpole.
Styresystemer og Multiprogrammering Block 3, 2005 Deadlocks Robert Glück.
Lecture 12 Handling Deadlock – Prevention, avoidance and detection.
1 OPERATING SYSTEMS DEADLOCKS created by:-gaurav shrivastava contact:- om.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
CS307 Operating Systems Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Deadlocks References –text: Tanenbaum ch.3. Deadly Embrace Deadlock definition –A set of process is dead locked if each process in the set is waiting.
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);
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 7: Deadlocks.
OPERATING SYSTEM CONCEPTS AND PRACTISE
Process Management Deadlocks.
ITEC 202 Operating Systems
OPERATING SYSTEMS DEADLOCKS
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 7 Deadlocks.
Process Deadlocks.
Chapter 7: Deadlocks.
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.
Deadlocks Peng Lu In a multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources; if the.
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlocks Session - 13.
DEADLOCK.
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
IT3002 Computer Architecture
OPERATING SYSTEMS DEADLOCKS.
DEADLOCKS.
Introduction to Deadlocks
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Chapter 7: Deadlocks.
Presentation transcript:

CCR Deadlock By: Laura Weiland April 30, 2002

Project Description Implement a module to the Train Operating System (TOS) that manages the deadlock problem for the Computer Controlled Railroad (CCR).

CCR Overview Computer chips are imbedded each train. Computer sends signals to the track that the chips in the trains detect. Photocells imbedded within the track that sense a change in light (i.e. a train passing by).

Lesson in Deadlock 4 Conditions Necessary for Deadlock –Mutual Exclusion: Only one train can hold a resource (photocell(s)) at any given time. –Hold and Wait: A train may hold a resource (photocell) while requesting another. –No Preemption: Resources (photocells) cannot be taken from a train, the train must release them. –Circular Wait: Two or more trains in a circular chain waiting for a resource (photocell) held by the next train in the chain.

Dealing with Deadlock Prevention: Ensure that one of the four conditions does not happen. Avoidance: A conservative allocation of resources. Only grant resources under safe conditions. Detection and Recovery: Grant any available resource with a way to detect and recover from deadlock should it occur. Ignore the Problem!

Inherited Train Operating System Jeremy Vosters 2001 Senior Capstone Project (TOS) - an Operating System for CCR –Operating System allows for multiple trains to run under batch or interactive modes. –Managed active and blocked trains. –Stopped trains from colliding. –Ignores the problem of deadlock. Dr. McVey’s modifications to TOS –Allowed user to assign train starting positions. –Trains not allowed to start in a position where resources are not available.

Building Blocks Batch Processing –Interactive processing allowed for various unknown variables. –Inherited: Trains can move in a single direction around the track. –Modifications made to allow trains to change direction within instruction cycle.

Building Blocks (Cont.) Sliding Past Photocells –Given the momentum of the trains while in motion, sudden stopping and/or changing directions can lead to trains sliding past desired photocells. –Another variable was added to the train data type that indicates the last photocell it successfully departed from. –If an arrival is issued for a train at the same photocell it has just departed, the train has slid past the photocell and the cursor to the train’s next instruction needs to be adjusted.

Deadlock Detection The detection algorithm is executed each time a train is added to the blocked train list. Detection Algorithm –Fill an indexed array with the train id and blocking photocell for each train in the blocked train list. –Search array for a circular pattern that would indicate deadlock. Deadlock Detected _________________ Deadlock Not Detected

Trains Blocked, No Deadlock Deadlock Deadlock Detection (Cont.)

Deadlock Recovery Once deadlock has been detected, the recovery process begins. Recovery Algorithm –One train moves back an instruction in its sequence, thus returning to the photocell it just came from. –Blocked trains that now have resources available are released. –The train that was moved back in its instruction sequence continues on from this point in its sequence.

Deadlock Recovery (Cont.) Deciding which train to back up an instruction –The train with the highest id number that can successfully back up an instruction. Algorithm not track specific. Decreases additional data structures and case statements. Recovering using trains in increasing id number resulted in two trains oscillating due to the release algorithm. Trains checked for recovery potential before recovery process put into motion. –Failure to do so could result in an infinite loop of deadlock.

Deadlock Avoidance “Yellow Light” Method of Avoidance –A yellow signal indicates that the next section of track is clear, but that the following section is occupied or unsafe. –As trains allocate their next section of track, they remove existing yellow flags and mark the section(s) following with a yellow flag(s). –A train wishing to allocate a section of track that has been flagged yellow by another train will be blocked and its yellow light signal(s) are removed. –This algorithm finds a basis in today’s railroad signaling.

Deadlock Avoidance (Cont.) Yellow Light Allocation Illustration

Deadlock Prevention Suggestion: –Trains going opposite directions can cause deadlock quickly. Thus, only allow trains to move in one direction. –If all trains are going a single direction, it would take 6 trains to create deadlock on this layout, thus allow only a maximum number of 5 trains on the track.

Resources Log System states were recorded in a log for each event handled by a train. –The log file has record of whether or not the system is in a state of deadlock each time a train is added to the blocked trains list. –Recovery steps are announced in the log file if deadlock was detected. –Given the new deadlock solutions put in place, warning of an unsafe system state is known before deadlock will be detected.

Future Extension Artificial Intelligence (AI) –Recovery methods could include AI techniques that would take into consideration the probability of entering into another instance of deadlock.

Demonstration

Questions?

Strategies Break problem down into smaller, more manageable pieces. Design at a high-level before trying to implement algorithms. Test, test, and test again.

Knowledge Independent Study Operating Systems Course

Advice Plan ahead. Break problem down into manageable tasks. Use log files for testing purposes.

Overall Experience Brought out the science in computer science. Teaches organization, time management, experimentation, analysis, patients… Great preparation for graduate school.

Thank You For Coming!