Operating Systems: William Stallings. Starvation. Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall

Similar documents
Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Chapter 6 Concurrency: Deadlock and Starvation

Concurrency: Deadlock and Starvation. Chapter 6

Chapters 5 and 6 Concurrency

Concurrency: Deadlock and Starvation. Chapter 6

ECE519 Advanced Operating Systems

Concurrency: Deadlock and Starvation

Chapter 6 Concurrency: Deadlock and Starvation

Deadlock and Starvation

CSCE Operating Systems Deadlock. Qiang Zeng, Ph.D. Fall 2018

CSE 306/506 Operating Systems Deadlock. YoungMin Kwon

JOINT PROGRESS WITH DEADLOCK RESOURCE CATEGORIES AND DEADLOCK

DEADLOCK CS 409, FALL 2013 DEADLOCK AND STARVATION/1

Concurrency: Principles of Deadlock. Processes and resources. Concurrency and deadlocks. Operating Systems Fall Processes need resources to run

Last Class: Monitors. Real-world Examples

Deadlock and Starvation

More on Synchronization and Deadlock

Deadlock 1 Chapter 6

Chapter 7: Deadlocks 1

Deadlock 1 Chapter 6

CSCC 69H3 2/1/13. Today: Deadlock. Remember example from last week? Example of Deadlock. Example: dining philosophers: Not just an OS Problem!

System Model. Types of resources Reusable Resources Consumable Resources

Operating Systems. Operating Systems Sina Meraji U of T

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?

ECS 150 (Operating Systems) Goal To examine what causes deadlock, and what to do about it. Spring Quarter

The Deadlock Problem (1)

Sistemas Operacionais I. Valeria Menezes Bastos


Lecture 9: Midterm Review

Chapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles

Deadlock and Starvation

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Semaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }

Chapter 3. Deadlocks

CSE 153 Design of Operating Systems

Process Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

Last Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples

OPERATING SYSTEM : RBMCQ0402. Third RavishBegusarai.

DUH! Deadlocks. Concurrency Issues. The TENEX Case. If a process requests all systems buffers, operator console tries to print an error message

Module 6: Process Synchronization. Operating System Concepts with Java 8 th Edition

CS 153 Design of Operating Systems Winter 2016

OPERATING SYSTEMS. Deadlocks

Operating Systems. Deadlock. User OS. Kernel & Device Drivers. Interface Programs. Brian Mitchell - Operating Systems

Resources. Lecture 4. Deadlocks. Resources (2) Resources (1) Four Conditions for Deadlock. Introduction to Deadlocks

Deadlock Prevention. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

Deadlocks. Thomas Plagemann. With slides from C. Griwodz, K. Li, A. Tanenbaum and M. van Steen

6. Concurrency: Deadlock

Operating Systems ECE344. Ding Yuan

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Deadlock

Chapter 3. Deadlocks

Chapter 6. Deadlock. (A Quick Introduction)

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Deadlock. Pritee Parwekar

Chapter 5 Concurrency: Mutual Exclusion and Synchronization

Deadlocks. Deadlock in Resource Sharing Environment. CIT 595 Spring Recap Example. Representing Deadlock

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Chapter 6 Concurrency: Deadlock and Starvation

DEADLOCKS M O D E R N O P E R A T I N G S Y S T E M S C H A P T E R 6 S P R I N G

Last Class: Synchronization Problems!

Deadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1

Synchronization for Concurrent Tasks

CSE 4/521 Introduction to Operating Systems

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

Chapter 6: Synchronization. Operating System Concepts 8 th Edition,

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

CS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

Concurrency. Chapter 5

Semaphores. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

OPERATING SYSTEMS INTERNALS AND DESIGN PRINCIPLES. William Stallings SIXTH EDITION. Pearson Education International. Prentice Hall

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Deadlocks. Today. Next Time. ! Resources & deadlocks! Dealing with deadlocks! Other issues. ! Memory management

Lecture 3: Synchronization & Deadlocks

Uniprocessor Scheduling

Last Class: Deadlocks. Today

Concurrency Issues. Past lectures: What about coordinated access across multiple objects? Today s lecture:

Process Management. Deadlock. Process Synchronization. Management Management. Starvation

Concurrency: Mutual Exclusion and

Process Management And Synchronization

11 Resource Management Deadlock and Starvation

COS 318: Operating Systems. Deadlocks. Jaswinder Pal Singh Computer Science Department Princeton University

Operating Systems 2006/2007

Chapter - 4. Deadlocks Important Questions

Deadlocks. Dr. Yingwu Zhu

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

COMPUTER SCIENCE 4500 OPERATING SYSTEMS

Resource management. Real-Time Systems. Resource management. Resource management

Computer Science 4500 Operating Systems. In This Module. Deadlock Definition. Module 7 Deadlocks

Computer Science 4500 Operating Systems

UNIT:2. Process Management

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 6: Process Synchronization. Operating System Concepts 9 th Edit9on

Deadlocks. Tore Larsen. With slides from T. Plagemann, C. Griwodz, K. Li, A. Tanenbaum and M. van Steen

Operating Systems. Lecture3.2 - Deadlock Management. Golestan University. Hossein Momeni

MODERN OPERATING SYSTEMS. Third Edition ANDREW S. TANENBAUM. Chapter 6 Deadlocks

Advanced Synchronization and Deadlock

Transcription:

Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 6 Concurrency: Deadlock and Starvation Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall

Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting needs for resources by two or more processes

Deadlock

Deadlock

Deadlock

Reusable Resources Used by only one process at a time and not depleted by that use Processes obtain resources that they later release for reuse by other processes

Reusable Resources Processors, I/O channels, main and secondary memory, devices, and data structures such as files, databases, and semaphores Deadlock occurs if each process holds one resource and requests the other

Reusable Resources

Reusable Resources Space is available for allocation of 200Kbytes, and the following sequence of events occur P1... Request 80 Kbytes;... Request 60 Kbytes; P2... Request 70 Kbytes;... Request 80 Kbytes; Deadlock occurs if both processes progress to their second request

Consumable Resources Created (produced) and destroyed (consumed) Interrupts, signals, messages, and information in I/O buffers Deadlock may occur if a Receive message is blocking May take a rare combination of events to cause deadlock

Example of Deadlock Deadlock occurs if receives blocking... Receive(P2);... P1 Send(P2, M1);... Receive(P1);... P2 Send(P1, M2);

Resource Allocation Graphs Directed graph that depicts a state of the system of resources and processes

Conditions for Deadlock Mutual exclusion Only one process may use a resource at a time Hold-and-wait A process may hold allocated resources while awaiting assignment of others

Conditions for Deadlock No preemption No resource can be forcibly removed form a process holding it Circular wait A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain

Resource Allocation Graphs

Resource Allocation Graphs

Possibility of Deadlock Mutual Exclusion No preemption Hold and wait

Existence of Deadlock Mutual Exclusion No preemption Hold and wait Circular wait

Deadlock Prevention Mutual Exclusion Must be supported by the OS Hold and Wait R i t ll f it i d Require a process request all of its required resources at one time

Deadlock Prevention No Preemption Process must release resource and request again OS may preempt a process to require it releases its resources Circular Wait Define a linear ordering of resource types

Deadlock Avoidance A decision is made dynamically whether the current resource allocation request will, if granted, potentially lead to a deadlock Requires knowledge of future process requests

Two Approaches to Deadlock Avoidance Do not start a process if its demands might lead to deadlock Do not grant an incremental resource request to a process if this allocation might lead to deadlock

Resource Allocation Denial Referred to as the banker s algorithm State of the system is the current allocation of resources to process Safe state t is where there is at least one sequence that does not result in deadlock Unsafe state is a state that is not safe

Determination of a Safe State

Determination of a Safe State

Determination of a Safe State

Determination of a Safe State

Determination of an Unsafe State

Deadlock Avoidance Logic

Deadlock Avoidance Logic

Deadlock Avoidance Maximum resource requirement must be stated in advance Processes under consideration must be independent; no synchronization requirements There must be a fixed number of resources to allocate No process may exit while holding resources

Deadlock Detection

Strategies Once Deadlock Detected Abort all deadlocked processes Back up each deadlocked process to some previously defined checkpoint, and restart all process Original deadlock may occur

Strategies Once Deadlock Detected Successively abort deadlocked processes until deadlock no longer exists Successively preempt resources until deadlock no longer exists

Advantages and Disadvantages a

Dining Philosophers Problem

Dining Philosophers Problem

Dining Philosophers Problem

Dining Philosophers Problem

Dining Philosophers Problem

UNIX Concurrency Mechanisms Pipes Messages Shared memory Semaphores Signals

UNIX Sg Signals as

Linux Kernel Concurrency Mechanism Includes all the mechanisms found in UNIX Atomic operations execute without interruption and without interference

Linux Atomic Operations

Linux Atomic Operations

Linux Spinlocks

Linux Semaphores

Linux Memory Barrier Operations

Solaris Thread Synchronization Primitives Mutual exclusion (mutex) locks Semaphores Multiple readers, single writer (readers/writer) locks Condition o variables ab

Solaris Synchronization Data Structures

Windows Synchronization Objects