Chapter 5 - Process Management

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

Chapter 5 Deadlocks. Contents What is deadlock? What is deadlock? Characterization Characterization Resource allocation graph Resource allocation graph.
Operating Systems Lecture Notes Deadlocks Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Understanding Operating Systems Fifth Edition Chapter 5 Process Management.
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 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.
Deadlock Chapter 3 R1 R2 P2P1 Allocated Requested.
Understanding Operating Systems Sixth Edition
Chapter 8 Deadlocks.
The Banker’s Algorithm for A Single Resource
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
Concurrency: Deadlock & Starvation
Chapter 5 : Process Management
Understanding Operating Systems Sixth Edition
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 7: Deadlock Dr. Mohamed Hefeeda.
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:
Understanding Operating Systems Seventh Edition
Deadlock Chapter 3 Thursday, February 22, Today’s Schedule Assignment #4 from Chapter 3 posted Deadlock - Chapter 3  Skip multiple resources (3.4.2.
Chapter 5 Process Management Understanding Operating Systems, Fourth Edition.
CH 3 Deadlock When 2 (or more) processes remain blocked forever!
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.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 Part III: Process Management (Deadlocks)
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 MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
CS6502 Operating Systems - Dr. J. Garrido Deadlock – Part 2 (Lecture 7a) CS5002 Operating Systems Dr. Jose M. Garrido.
Process Synchronization
Deadlock Operating Systems: Internals and Design Principles.
Chapter 7 Deadlocks Page 2 Chapter 7: Deadlocks 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.
Deadlocks System Model RAG Deadlock Characterization
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.
Styresystemer og Multiprogrammering Block 3, 2005 Deadlocks Robert Glück.
1 OPERATING SYSTEMS DEADLOCKS created by:-gaurav shrivastava contact:- om.
Operating Systems Unit VI Deadlocks and Protection Department of Computer Science Engineering and Information Technology.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 6 Deadlocks Slide 1 Chapter 6 Deadlocks.
Chapter 5 Process Management Semester 2. Objectives  What is a deadlock?  Seven cases of deadlocks  Conditions of deadlocks –Mutual exclusion.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
7: Deadlocks1 OPERATING SYSTEMS DEADLOCKS. 7: Deadlocks2 What Is In This Chapter? What is a deadlock? Staying Safe: Preventing and Avoiding Deadlocks.
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 Operating Systems (CC2011NI) -Mr. Pranoy Man Pradhan.
Process Management Deadlocks.
Chapter 5 Process Management
Virtual Memory Networks and Communication Department.
Chapter 7 – Deadlock and Indefinite Postponement
Operating Systems (CS 340 D)
Understanding Operating Systems Seventh Edition
OPERATING SYSTEMS DEADLOCKS
Lecture 19: Deadlock: Conditions, Detection and Avoidance
Chapter 7 Deadlocks.
Chapter 7: Deadlocks.
Process Deadlocks.
Chapter 7: Deadlocks.
G.Anuradha Ref:- Galvin
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
Deadlocks Session - 13.
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 8: Deadlocks Deadlock Characterization
Presentation transcript:

Chapter 5 - Process Management CIS106 Microcomputer Operating Systems Gina Rue CIS Faculty Ivy Tech State College Northwest Region 01

Introduction - Process Management Problems are caused when many processes compete for relatively few resources & the system is unable to service all the processes of the system A lack of process synchronization can result in two extreme conditions deadlock starvation See Illustration p.99

Process Management - Deadlock In early OSs, deadlock was known as “deadly embrace” begins when two or more jobs requests a resource jobs are put on hold, each waiting for vital resources to become available, jobs come to a standstill

Process Management - Deadlock Deadlock is complete if the rest of the system comes to a standstill as well Usually can’t be resolved by the OS and requires intervention operators/users terminate job Deadlock described as a narrow staircase in a building Starvation is an extreme case of indefinite postponement

Deadlock More serious than indefinite postponement or starvation affects more than one job affects resources of the entire system were more infrequent in early batch systems became more prevalent with growing use of interactive systems See Fig. 5.1 p. 101

Seven Cases of Deadlock Deadlock usually occurs when non-sharable, non-preemptable resources, such as files, printers are allocated jobs that eventually require--the resources that have been locked by other jobs also with resources such as tape drives, disks, & databases What is an operating system?

Seven Cases of Deadlock A Deadlock can occur with File Requests - if jobs are allowed to request and hold files for the duration of their execution Databases - if two processes access and lock records in a database. Note: Locking & Race Device Allocation - use of a group of dedicated devices, tape drive Multiple Device Allocation - can happen when several processes request, & hold two devices while other processes act in a similar manor

Seven Cases of Deadlock (con’t.) A Deadlock can occur with Spooling - where a disk, between the device (printer) and CPU, accepts output from several users (network) and acts as a temporary storage area for all output until the printer is ready to accept it Disk Sharing - two processes to be accessing different areas of the same disk causing competing processes that send conflicting commands Network - congested or has large % of its I/O buffer space full if no protocol controls flow of traffic

Conditions For Deadlock Deadlock is proceeded by the simultaneous occurrence of 4 conditions the OS can recognize mutual exclusion resource holding no preemption circular wait

Conditions For Deadlock Stairway example: mutual exclusion, the act of allowing only one person (or process) to have access to a step (or resource) resource holding, two people met on the stairs & each waited for the other to retreat no preemption, each step is dedicated to the climber (or descender) as long as needed circular wait, each person (or process) involved is waiting for another to release the step (or resource)

Modeling Deadlocks Directed Graphs Holt (1972) two kinds of symbols processes represented by circles resources represented by squares solid lines from a resource to a process means that the process is holding that resource from a process to a resource means that the process is waiting for that resource arrows direction indicates the flow See Fig. 5.7 - 10 p.108-110

Strategies for Handling Deadlocks Requests & releases are received in an unpredictable order, which makes it difficult to design a foolproof preventive policy. An OS uses 1 of 3 strategies to deal with deadlocks: Prevent one user of the 4 conditions from occurring Avoid deadlock if it becomes probable Detect the deadlock when it occurs & recover from it gracefully

Strategies for Handling Deadlocks Deadlock recovery strategies require that at least one victim, an expendable job, when removed from the system, will free the system. Victim selection should have the least effect on the system: Priority of the job CPU time used by the job The number of jobs

Starvation The result of conservative allocation of resources where a single job is prevented from execution because it is waiting for resources that never become available an algorithm designed to detect starving jobs can be implemented, which tracks how long each job has been waiting for resources (this is the same as aging described in Ch.4)

Summary Every OS must dynamically allocate a limited number of resources while avoiding the 2 extremes of deadlock & starvation Methods of dealing with deadlock prevention avoidance detection recovery

Summary Deadlocks can be prevented by not allowing the 4 conditions of deadlock to occur in the system at the same time mutual exclusion resource holding no preemption circular wait By eliminating at least one of the 4 conditions, a system can be kept deadlock-free

Summary Prevention algorithms are complex & to routinely execute them involves high overhead Avoid by identifying safe & unsafe states Prepare to detect and recover from deadlock “victim” a job must be terminated before it finishes execution & must be started again