Overview Assignment 8: hints Assignment 7: solution Deadlocks

Slides:



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

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.
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.
Synchronization Algorithms and Concurrent Programming
DEADLOCK. Contents  Principles of deadlock  Deadlock prevention  Deadlock detection.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Deadlock Emery Berger and Mark Corner University of Massachusetts.
02/27/2004CSCI 315 Operating Systems Design1 Process Synchronization Deadlock Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 81 Deadlock is:  A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.  Example.
1 Deadlocks Chapter Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Tanenbaum Ch 6 Silberschatz Ch 7
Deadlock Chapter 3 R1 R2 P2P1 Allocated Requested.
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.
Deadlocks. 2 System Model There are non-shared computer resources –Maybe more than one instance –Printers, Semaphores, Tape drives, CPU Processes need.
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.
1 Lecture 8: Deadlocks Operating System Spring 2008.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Bridge Crossing Example Traffic only in one direction. Each section.
Chapter 6 Deadlocks Resources Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 7: Deadlock Dr. Mohamed Hefeeda.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Deadlock Questions answered in this lecture: What are the four necessary conditions for deadlock? How can deadlock be prevented? How can deadlock be avoided?
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
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 Resource 3.2. Introduction to deadlocks 3.3. The ostrich algorithm 3.4. Deadlock detection and recovery 3.5. Deadlock avoidance.
Deadlocks Silberschatz Ch. 7 and Priority Inversion Problems.
1 Deadlock. 2 Concurrency Issues Past lectures:  Problem: Safely coordinate access to shared resource  Solutions:  Use semaphores, monitors, locks,
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
This Time - Deadlock Definition Conditions for deadlocks
CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Deadlock cs550 Operating Systems David Monismith.
CS 241 Section Week #7 (10/22/09). Topics This Section  Midterm Statistics  MP5 Forward  Classical Synchronization Problems  Problems.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Deadlocks System Model RAG Deadlock Characterization
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings.
Deadlock. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock.
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.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Deadlock.
Deadlocks CPE Operating Systems
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
Transaction Management
Concurrency: Deadlock and Starvation
Operating systems Deadlocks.
Chapter 7: Deadlocks Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Advanced Operating System Fall 2009
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 7: 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.
Operating systems Deadlocks.
Lecture 2 Part 2 Process Synchronization
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.
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlock A deadlock situation on a resource can arise if and only if all of the following conditions hold simultaneously in a system: Mutual exclusion.
Introduction to Deadlocks
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
CSE 542: Operating Systems
CSE 542: Operating Systems
Chapter 8: Deadlocks Deadlock Characterization
Presentation transcript:

Overview Assignment 8: hints Assignment 7: solution Deadlocks See sample solution on the web

A8 Ex1 – Barrier Objects synchronize processes “checkpoint”: continue only when all processes are there checkpoint checkpoint checkpoint Barrier = OBJECT Init(count); Sync; PROCESS: FOR i := 0 TO Max DO DoPhase(i); barrier.Sync END

Barrier, Example P1 P2 P3 // code before the barrier Barrier.synchronize() // code after the barrier

A8 Ex1 - Task Write a barrier implementation in the (reasonable) language of your choice. The Barrier object should have the following methods: Initialize: to specify how many process are to be synchronized by this barrier. Synchronize: wait until all processes reached the barrier.

A8 Ex2 – Deadlocks Coffman conditions Solutions Mutual exclusion in resource usage Holding a resource and waiting No preemption of resources possible Circular wait Solutions use protocol that ensures the system will never deadlock detect deadlock and recover ignore (...and reboot)

Deadlocks Transactions in a bank Deadlock avoidance: move $ from x to y concurrent system acquire lock on both accounts, then perform transfer Deadlock avoidance: mutual exclusion (accounts are locked) no preemption (once locked, unlock only after transfer) hold and wait (first account locked, waiting for second one) must avoid circular wait..... HOW?

Deadlocks: example Example: p1: lock(x, y); p2: lock(y, x); Scenario: p1 locks x p2 locks y p1 tries to lock y and waits p2 tries to lock x and waits DEADLOCK

A8 Ex3 – Baboons Problem Part a): avoid deadlocks using semaphores. more than one baboon can cross (but only in one direction) if two (or more) baboons cross in different directions we have a deadlock. Part a): avoid deadlocks using semaphores. Part b): avoid starvation.