Deadlock avoidance Deadlock detection Resource Allocation Graphs

Slides:



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

Chapter 5 Deadlocks. Contents What is deadlock? What is deadlock? Characterization Characterization Resource allocation graph Resource allocation graph.
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.
Operating Systems Lecture Notes Deadlocks Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
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.
Ceng Operating Systems Chapter 2.4 : Deadlocks Process concept  Process scheduling  Interprocess communication  Deadlocks Threads.
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.
CSC 322 Operating Systems Concepts Lecture - 29: by
Deadlock CSCI 444/544 Operating Systems Fall 2008.
The ‘deadlock’ conditions Reviewing some key points concerning the potential for ‘deadlock’ in an operating system.
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlock Characterization
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 – 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 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.
Operating Systems 软件学院 高海昌 Operating Systems Gao Haichang, Software School, Xidian University 22 Contents  1. Introduction** 
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 Deadlock. 2 Concurrency Issues Past lectures:  Problem: Safely coordinate access to shared resource  Solutions:  Use semaphores, monitors, locks,
This Time - Deadlock Definition Conditions for deadlocks
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
CS 346 – Chapter 7 Deadlock –Properties –Analysis: directed graph Handle –Prevent –Avoid Safe states and the Banker’s algorithm –Detect –Recover.
CS333 Intro to Operating Systems Jonathan Walpole.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings.
Deadlocks 12/02/2015. What is a deadlock ? System has a finite set of resources. Resource can have one or more instances. Processes compete for resources.
Deadlock A deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. Example : “When.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
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.
Sistem Operasi IKH311 Deadlock. 2 Resources Examples of computer resources printers tape drives tables Processes need access to resources in reasonable.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Process Management Deadlocks.
CSE 120 Principles of Operating
Concurrency: Deadlock and Starvation
Deadlocks (part II) Deadlock avoidance – (not reasonable)
ITEC 202 Operating Systems
G.Anuradha Ref:- Galvin
Multiple Granularity Granularity is the size of data item  allowed to lock. Multiple Granularity is the hierarchically breaking up the database into portions.
CS703 - Advanced Operating Systems
Chapter 7 – Deadlock and Indefinite Postponement
Chapter 6 : Deadlocks What is a Deadlock?
Deadlocks (part II) Deadlock avoidance – (not reasonable)
Operating Systems (CS 340 D)
Introduction to Operating Systems
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.
Review: Readers-Writers Problem
Deadlocks Peng Lu In a multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources; if the.
Chapter 8: Deadlocks.
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlocks Session - 13.
DEADLOCK.
Chapter 7: Deadlocks.
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Introduction to Deadlocks
CSE 380 Lecture Note 12 Insup Lee
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Presentation transcript:

Deadlock avoidance Deadlock detection Resource Allocation Graphs DEadlocks Deadlock avoidance Deadlock detection Resource Allocation Graphs

Resource Tables

Deadlock Definition A deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does. P1 P2 P(R1) P(R2) P(R2) P(R1) CS CS V(R2) V(R1) V(R1) V(R2)

Deadlock 4 necessary conditions Mutual Exclusion – Processes claim exclusive control of the resources they require Wait For – processes hold resources already allocated to them while waiting for additional resources No Pre-emption – resources cannot be removed from the process using them until it is used to completion Circular Wait – A circular chain of processes exist in which each process holds one or more resources that are requested by the next process in the chain.

Deadlock avoidance Denying Mutex An Operating System that does not allow mutual exclusion. Problem: This would of course, never have any processes go into a deadlock state, but it’s silly to not allow any resource get exclusive access of a resource. Imagine you want to print a file but you can’t get exclusive access to the printer. You start printing your file, and at the same time another person prints a file. The files would get printed together…on the same paper.

Deadlock avoidance Deny Wait For Havender’s 1st strategy A process get all of it’s resources or none of them. Semaphores can be used. Problems: Must get everything before starting even if it is not needed at the moment Must know in advance, all the resources needed throughout the process.

Deadlock avoidance Deny Wait For Havender’s 2nd Strategy If a process is denied a resource, then it gives up all presently acquired resources. Problem: Could take a long time (possible forever) for a process to run if it keep getting some resources and then gives them up over and over again.

Deadlock avoidance Denying No Preemption Allow the OS to take resources held by processes and give them to processes needing them. Problem: How does the OS decide which processes to take from and which to give to? The gathering of resources will have to restart during processing and may restart infinite times (starvation).

Deadlock avoidance Denying Circular Wait Sequentially number all resources in the entire system. When a process is acquiring resources, the must follow the protocol of obtaining the resources in sequential order. Problem: Forced to acquire resources not needed for a while to maintain order. All programmers must know the order of resources

Resource Pool A collection of identical resources Ex) A room full of printers Computer Storage (on the stack or heap)

Dijkstra’s Banker’s Algorithm Total common resources is 8

Bankers Algo - 2 Resource Pools shared

RAG – Resource Allocation graph