A house of cards? Advanced Synchronization and Deadlock. Contra Threads: Events. Contra Threads: Events
|
|
- Laurel McCoy
- 5 years ago
- Views:
Transcription
1 A house of cards? Advanced Synchronization and Deadlock Locks + CV/signal a great way to regulate access to a single shared object......but general multi-threaded programs touch multiple shared objects How can we atomically modify multiple objects to maintain Safety: prevent applications from seeing inconsistent states Liveness: avoid deadlock a cycle of threads forever stuck waiting for one another Contra Threads: Events Contra Threads: Events John Ousterhout: Why Threads Are a Bad Idea (for most purposes) casual All programmers wizards John Ousterhout: Why Threads Are a Bad Idea (for most purposes) casual All programmers wizards Visual basic programmers C programmers Visual basic programmers C programmers C++ programmers Thread programmers Event-driven Programming No concurrency: one execution stream Register interest in events (callbacks) Wait for events; invoke (short-lived) handlers Complicated only for unusual cases Easier to debug C++ programmers Thread programmers Event Loop H H H 3 H 4 H 5
2 Multi-object synchronization Transfer $00 from account A to account B A->subtract(00); B->add(00); Fine-grain locking Hash table: } Individual put(key, value) value = get(key) value = remove(key) one lock for whole table? one lock per bucket? Complexity vs Performance operations are atomic Sequence is not Beware of premature optimizations! Careful class design You design the API! Too Much Milk with objects Fridge! Note!! back to square one... Instead No panacea Fridge::checkForMilk(); Fridge::addMilk() Note::readNote(); notewritenote() Fridge::checkForMilkAndSetNoteIfNeeded() Fridge::addMilk() still need to think carefully how objects interact Serialization Divide work into logically separate tasks Ensure serializable execution of tasks tasks may execute concurrently......but result of each task equivalent to what would be obtained if tasks executed one at a time in some serial order A few ways to get there one big lock lock-all/release-all two phase locking Serialization Divide work into logically separate tasks Ensure serializable execution of tasks tasks may execute concurrently......but result of each task equivalent to what would be obtained if tasks executed one at a time in some serial order A few ways to get there one big lock lock-all/release-all need to know all locks two phase locking Lock(A,B) A=A+ B=B+ Unlock(A,B) Lock(C,D) C=C+3 D=D+4 Unlock(C,D) Lock(A,B) A=A+ B=B+ Unlock(A,B) Lock(A,B) A=A+5 B=B+6 Unlock(A,b) Equivalent sequential execution Lock(C,D) C=C+3 D=D+4 Unlock(C,D) Lock(A,B) A=A+5 B=B+6 Unlock(A,b)
3 Serialization Divide work into logically separate tasks Ensure serializable execution of tasks tasks may execute concurrently......but result of each task equivalent to what would be obtained if tasks executed one at a time in some serial order A few ways to get there one big lock lock-all/release-all two phase locking serializable Phase acquire locks upgrade reader to writer lock if necessary Phase release locks downgrade writer to reader lock if necessary ownership pattern Shared container put things in; take them out; access them without a lock (own them) Network Stage Parse Stage Render Stage One thread/network connection One thread/object One thread/object Solution: staged architecture Each stage has local state and some thread that operate on it No state shared across stages Read Static Page Deadlock A cycle of waiting among a set of threads, where each thread is waiting for some other thread in the cycle to take some action Mutually recursive locking Nested waiting Connect Read and Parse Send Page S waiting for unlock S waiting for unlock Generate Dynamic Page waiting for unlock S S waiting for signal
4 Dining Philosophers Necessary conditions for deadlock Deadlock only if the all hold Not sufficient in general Bounded resources P0 A finite number of threads can use a resource; resources are finite No preemption the resource is mine, MINE! (until I release it) waiting for owned by P4 P Wait while holding N philosophers; N plates; N chopsticks If all philosophers grab right chopstick deadlock! Preventing deadlock holds one resource while waiting for another cycle Circular waiting Ti waits for Ti+ and holds a resource requested by Ti- sufficient if one instance of each resource P Avoiding Deadlock: The Banker s Algorithm E.W. Dijkstra & N. Habermann Remove one of the necessary conditions Provide sufficient resources Removes Bounded resources Preempt resources Removes No preemption Abort requests Removes Wait while holding Atomically acquire all resources Removes Wait while holding Lock ordering Removes Circular waiting Nested waiting? Sum of maximum resources needs can exceed the total available resources if there exists a schedule of loan fulfillments such that all clients receive their maximal loan build their house pay back all the loan More efficient than acquiring atomically all resources
5 Living dangerously: Safe, Unsafe, Deadlocked The Banker s books Safe: For any possible set of resource requests, there exists one safe schedule of processing requests that succeeds in granting all pending and future requests Unsafe Deadlock ij = max amount of units of resource Rj needed by Pi m Claimi = ij = current allocation of Rj held by Pi m HasNowi = A request by Pk is safe if there is schedule P, P,...Pn such that, for all Pi, assuming the request is granted, i X Claimi-HasNowi + HasNowi Deadlocked: The system has at least one deadlock j= An Example An Example R R R3 R4 R R R3 R4 P 0 0 P P 0 0 R R R3 R4 5 0 R R R3 R4 R R R3 R4 P P P P P P P P5 0 0 P Is this a safe state? ij j = number of units of Rj available unlucky set of requests can force deadlock X j= Unsafe: There exists a set of (pending and future) resource requests that leads to a deadlock, for any schedule in which requests are processed A system s trajectory through its state space ij j= no deadlock as long as system can enforce safe schedule Safe X P Request R R R3 R4 R R R3 R4 5 0 P 0 P P P P P5 0 0 P Is this a safe state? P, P4, P,, P5 While safe sequence does not include all processes: Is there a Pi such that Requesti? if no, exit with unsafe if yes, add Pi to the sequence and set = + HasNowi Exit with safe
6 An Example An Example R R R 3 R 4 R R R 3 R 4 Request R R R 3 R 4 R R R 3 R 4 0 R R R 3 R 4 R R R 3 R 4 Request R R R 3 R 4 R R R 3 R 4 0 P 0 0 P P P 0 0 P P P want to change its allocation to P want to change its allocation to Safe? Safe? Detecting Deadlock Detecting Deadlock 5 processes, 3 resources 5 processes, 3 resources R R R 3 Pending R R R 3 R R R 3 R R R 3 Pending R R R 3 R R R 3 P 0 0 P P 0 0 P Given the set of pending requests, is there a safe sequence? If no, deadlock Given the set of pending requests, is there a safe sequence? If no, deadlock Deadlock triggered when request is formulated, not granted
Advanced Synchronization and Deadlock
Advanced Synchronization and Deadlock A house of cards? Locks + CV/signal a great way to regulate access to a single shared object......but general multi-threaded programs touch multiple shared objects
More informationDeadlock Revisited. CS439: Principles of Computer Systems November 29, 2017
Deadlock Revisited CS439: Principles of Computer Systems November 29, 2017 Last Time Distributed File Systems Remote Procedure Calls (RPC) Consistency Models Coherence, Staleness, Consistency Network File
More informationDeadlock Revisited. CS439: Principles of Computer Systems April 23, 2018
Deadlock Revisited CS439: Principles of Computer Systems April 23, 2018 Last Time Distributed File Systems Remote Procedure Calls (RPC) Consistency Models Coherence, Staleness, Consistency Network File
More informationDeadlock. Concurrency: Deadlock and Starvation. Reusable Resources
Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting
More information! What is a deadlock? ! What causes a deadlock? ! How do you deal with (potential) deadlocks? Maria Hybinette, UGA
Chapter 8: Deadlock Questions? CSCI 4730 Operating Systems! What is a deadlock?! What causes a deadlock?! How do you deal with (potential) deadlocks? Deadlock Deadlock: What is a deadlock? Example: Two
More information!! What is a deadlock? !! What causes a deadlock? !! How do you deal with (potential) deadlocks? Maria Hybinette, UGA
Chapter 8: Deadlock Questions? CSCI [4 6]730 Operating Systems!! What is a deadlock?!! What causes a deadlock?!! How do you deal with (potential) deadlocks? Deadlock 2 Deadlock: What is a deadlock? Example:
More informationDeadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1
Deadlock Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Recap: Synchronization Race condition A situation when two or more threads read and write shared
More informationThe Deadlock Problem (1)
Deadlocks The Deadlock Problem (1) A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P 1 and P 2
More informationThe deadlock problem
Deadlocks Arvind Krishnamurthy Spring 2004 The deadlock problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process. Example locks A and B P 0 P
More informationOperating Systems: William Stallings. Starvation. Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall
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
More informationCS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University
CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):
More informationOperating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy
Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference
More informationDeadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example
Concepts to discuss Deadlock CSCI 315 Operating Systems Design Department of Computer Science Deadlock Livelock Spinlock vs. Blocking Notice: The slides for this lecture have been largely based on those
More informationChapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14
Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter
More informationSilberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices! " Silberschatz, Galvin and Gagne 2013!
Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter
More informationOPERATING SYSTEMS. Deadlocks
OPERATING SYSTEMS CS3502 Spring 2018 Deadlocks Chapter 7 Resource Allocation and Deallocation When a process needs resources, it will normally follow the sequence: 1. Request a number of instances of one
More informationLast Class: Synchronization Problems!
Last Class: Synchronization Problems! Reader Writer Multiple readers, single writer In practice, use read-write locks Dining Philosophers Need to hold multiple resources to perform task Lecture 11, page
More informationCOP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University
COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks Zhi Wang Florida State University Contents Deadlock problem System model Handling deadlocks deadlock prevention deadlock avoidance
More informationThe Deadlock Problem
Deadlocks 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. Example System has 2 disk drives. P1 and P2 each
More informationLast Class: Monitors. Real-world Examples
Last Class: Monitors Monitor wraps operations with a mutex Condition variables release mutex temporarily C++ does not provide a monitor construct, but monitors can be implemented by following the monitor
More informationChapter - 4. Deadlocks Important Questions
Chapter - 4 Deadlocks Important Questions 1 1.What do you mean by Deadlocks? A process request for some resources. If the resources are not available at that time, the process enters a waiting state. The
More informationChapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013!
Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection
More informationDeadlock Risk Management
Lecture 6: Deadlocks, Deadlock Risk Management Readers and Writers with Readers Priority Shared data semaphore wrt, readcountmutex; int readcount Initialization wrt = 1; readcountmutex = 1; readcount =
More informationR13 SET - 1 2. Answering the question in Part-A is compulsory 1 a) Define Operating System. List out the objectives of an operating system. [3M] b) Describe different attributes of the process. [4M] c)
More informationCS420: Operating Systems. Deadlocks & Deadlock Prevention
Deadlocks & Deadlock Prevention James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne The Deadlock Problem
More informationConcurrency: Principles of Deadlock. Processes and resources. Concurrency and deadlocks. Operating Systems Fall Processes need resources to run
Concurrency: Principles of Deadlock Operating Systems Fall 2002 Processes and resources Processes need resources to run CPU, memory, disk, etc process waiting for a resource cannot complete its execution
More informationDeadlocks. Copyright : University of Illinois CS 241 Staff 1
Deadlocks 1 Deadlock Which way should I go? 2 Deadlock I Oh can no! almost I m get stuck! across GRIDLOCK! 3 Deadlock Definition Deadlocked process Waiting for an event that will never occur Typically,
More informationPrinciples of Operating Systems
Principles of Operating Systems Lecture 11 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and course
More informationChapter 7: Deadlocks. Operating System Concepts 8th Edition, modified by Stewart Weiss
Chapter 7: Deadlocks, Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance (briefly) Deadlock Detection
More informationDeadlocks. Deadlock in Resource Sharing Environment. CIT 595 Spring Recap Example. Representing Deadlock
Deadlock in Resource Sharing Environment Operating System Deadlocks CIT 595 Spring 2010 A deadlock occurs when 2 or more processes/threads permanently block each other by each having a lock on a resource
More informationDeadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018
Deadlock and Monitors CS439: Principles of Computer Systems September 24, 2018 Bringing It All Together Processes Abstraction for protection Define address space Threads Share (and communicate) through
More informationChapter 7: Deadlocks
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 Deadlock Avoidance 7.6 Deadlock Detection 7.7 Recovery
More informationMaximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait
Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU
More informationUNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock.
UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process
More informationChapter 7: Deadlocks. Operating System Concepts 9 th Edition
Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection
More informationConcurrency: Deadlock and Starvation. Chapter 6
Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involve conflicting needs for resources
More informationDeadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1
Deadlock Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Recap: Synchronization Race condition A situation when two or more threads read and write shared
More informationDeadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1
Deadlock Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1 Recap: Synchronization Race condition A situation when two or more threads read and write shared
More informationSystem Model. Types of resources Reusable Resources Consumable Resources
Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock System Model Types
More informationPrinciples of Operating Systems
Principles of Operating Systems Lecture 16-17 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and
More informationLecture 3: Synchronization & Deadlocks
Lecture 3: Synchronization & Deadlocks Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating
More informationDeadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources.
Deadlock Prevention Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources. Hold and Wait must guarantee that whenever a process
More informationOperating Systems Antonio Vivace revision 4 Licensed under GPLv3
Operating Systems Antonio Vivace - 2016 revision 4 Licensed under GPLv3 Process Synchronization Background A cooperating process can share directly a logical address space (code, data) or share data through
More informationICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian
ICS 143 - Principles of Operating Systems Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian nalini@ics.uci.edu Outline System Model Deadlock Characterization Methods for handling deadlocks Deadlock
More informationCHAPTER 6: PROCESS SYNCHRONIZATION
CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background
More informationChapter 7: Deadlocks
Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Chapter
More informationMore on Synchronization and Deadlock
Examples of OS Kernel Synchronization More on Synchronization and Deadlock Two processes making system calls to read/write on the same file, leading to possible race condition on the file system data structures
More informationAdvanced Topic: Efficient Synchronization
Advanced Topic: Efficient Synchronization Multi-Object Programs What happens when we try to synchronize across multiple objects in a large program? Each object with its own lock, condition variables Is
More information6. Concurrency: Deadlock
CSC400 - Operating Systems 6. Concurrency: Deadlock J. Sumey Deadlock one problem that results from multiprogramming def: a process (or thread) is said to be deadlocked if it is waiting for an event that
More informationWhat is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?
What is the Race Condition? And what is its solution? Race Condition: Where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L14 Deadlocks Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Mutex vs Semaphore 2 2 FAQ Does
More informationChapter 7: Deadlocks CS370 Operating Systems
Chapter 7: Deadlocks CS370 Operating Systems Objectives: Description of deadlocks, which prevent sets of concurrent processes from completing their tasks Different methods for preventing or avoiding deadlocks
More informationCS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian
1 CS153: Deadlock Chengyu Song Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian 2 Administrivia Lab Lab1 is due this Sunday Demo sessions next week Little book of semaphores First
More informationDeadlocks. Dr. Yingwu Zhu
Deadlocks Dr. Yingwu Zhu Deadlocks Synchronization is a live gun we can easily shoot ourselves in the foot Incorrect use of synchronization can block all processes You have likely been intuitively avoiding
More informationDeadlock 1 Chapter 6
Deadlock 1 Chapter 6 2 Deadlock A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set Permanent blocking
More informationChapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition
Chapter 7: Deadlocks 7.1 Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock
More informationDeadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring
A Bit More on Synchronization Deadlock CS 256/456 Dept. of Computer Science, University of Rochester Synchronizing interrupt handlers: Interrupt handlers run at highest priority and they must not block.
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 16 Deadlock Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Does a cycle in a resource
More informationUNIT:2. Process Management
1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria
More informationDeadlock Risk Management
Lecture 5: Deadlocks, Deadlock Risk Management Contents The Concept of Deadlock Resource Allocation Graph Approaches to Handling Deadlocks Deadlock Avoidance Deadlock Detection Recovery from Deadlock AE3B33OSD
More informationChapter 7: Deadlocks. Operating System Concepts 8 th Edition,
Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance
More informationThe Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.
The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. System Model Deadlock Characterization Methods of handling
More informationChapter 6 Concurrency: Deadlock and Starvation
Operating Systems: Internals and Design Principles Chapter 6 Concurrency: Deadlock and Starvation Seventh Edition By William Stallings Edited by Rana Forsati CSE410 Outline Principles of deadlock Deadlock
More informationECS 150 (Operating Systems) Goal To examine what causes deadlock, and what to do about it. Spring Quarter
D e a d l o c k Goal To examine what causes deadlock, and what to do about it. Spring Quarter 1999 1 The resource manager is that part of the kernel responsible for managing resources. Its process interface
More informationThe Deadlock Problem
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. Example System has 2 disk drives. P 1 and P 2 each hold one
More informationChapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example
Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance
More informationContents. Chapter 8 Deadlocks
Contents * All rights reserved, Tei-Wei Kuo, National Taiwan University,.. Introduction. Computer-System Structures. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization
More informationECE519 Advanced Operating Systems
IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (6 th Week) (Advanced) Operating Systems 6. Concurrency: Deadlock and Starvation 6. Outline Principles of Deadlock
More informationDeadlock and Starvation
Deadlock and Starvation Deadlock Permanent blocking of a set of processes Processes are waiting on events, but the events can only be triggered by other blocked processes No simple, efficient solution
More informationSemaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }
Semaphore Semaphore S integer variable Two standard operations modify S: wait() and signal() Originally called P() and V() Can only be accessed via two indivisible (atomic) operations wait (S) { while
More informationDeadlock CS 241. March 19, University of Illinois
Deadlock CS 241 March 19, 2014 University of Illinois Slides adapted in part from material accompanying Bryant & O Hallaron, Computer Systems: A Programmer's Perspective, 2/E 1 The Dining Philosophers
More informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can
More informationDUH! Deadlocks. Concurrency Issues. The TENEX Case. If a process requests all systems buffers, operator console tries to print an error message
1 Concurrency Issues Past lectures: Problem: Safely coordinate access to shared resource Solutions: Use semaphores, monitors, locks, condition variables Coordinate access within shared objects Deadlocks
More informationChapter 7: Deadlocks
Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from
More informationConcurrency: Deadlock and Starvation
Concurrency: Deadlock and Starvation Chapter 6 E&CE 354: Processes 1 Deadlock Deadlock = situation in which every process from a set is permanently blocked, i.e. cannot proceed with execution Common cause:
More informationProcess-1 requests the tape unit, waits. In this chapter, we shall analyze deadlocks with the following assumptions:
Chapter 5 Deadlocks 5.1 Definition In a multiprogramming system, processes request resources. If those resources are being used by other processes then the process enters a waiting state. However, if other
More informationChapter 8: Deadlocks
Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock
More informationChapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization
Chapter 8: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined
More informationThe Deadlock Problem
Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock The Deadlock
More informationChapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks
Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance
More informationCHAPTER 7 - DEADLOCKS
CHAPTER 7 - DEADLOCKS 1 OBJECTIVES To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods for preventing
More informationLast Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples
Last Class: Synchronization Problems Reader Writer Multiple readers, single writer In practice, use read-write locks Dining Philosophers Need to hold multiple resources to perform task Lecture 10, page
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST II Date: 04/04/2018 Max Marks: 40 Subject & Code: Operating Systems 15CS64 Semester: VI (A & B) Name of the faculty: Mrs.Sharmila Banu.A Time: 8.30 am 10.00 am Answer any FIVE
More informationTDDB68 + TDDD82. Lecture: Deadlocks
TDDB68 + TDDD82 Lecture: Deadlocks Mikael Asplund, Senior Lecturer Real-time Systems Laboratory Department of Computer and Information Science Thanks to Simin Nadjm-Tehrani and Christoph Kessler for much
More informationCSE 306/506 Operating Systems Deadlock. YoungMin Kwon
CSE 306/506 Operating Systems Deadlock YoungMin Kwon Deadlock A set of processes are deadlocked if Each process in the set is blocked and Waiting for an event that can be triggered only from another process
More informationModule 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model
Module 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined
More informationChapter 7: Deadlocks. Operating System Concepts 8 th Edition,
Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number
More informationDeadlock. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS Lahore Pakistan. Department of Computer Science
Deadlock Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS Lahore Pakistan Operating System Concepts Deadlock A process in a multiprogramming system is said to
More informationClass Notes, 3/21/07, Operating Systems
Class Notes, 3/21/07, Operating Systems Hi, Jane. Thanks again for covering the class. One of the main techniques the students need to how to recognize when there is a cycle in a directed graph. (Not all
More informationDeadlocks. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Deadlocks Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics What is the deadlock problem? Four conditions for deadlock Handling deadlock
More informationCMSC 412. Announcements
CMSC 412 Deadlock Reading Announcements Chapter 7 Midterm next Monday In class Will have a review on Wednesday Project 3 due Friday Project 4 will be posted the same day 1 1 The Deadlock Problem A set
More informationDEADLOCKS 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
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 2 0 1 8 NON-RESOURCE DEADLOCKS Possible for two processes to deadlock each is waiting for the other to do some task Can
More informationChapter 6 Concurrency: Deadlock and Starvation
Operating Systems: Internals and Design Principles Chapter 6 Concurrency: Deadlock and Starvation Seventh Edition By William Stallings Operating Systems: Internals and Design Principles When two trains
More informationCHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.
CHAPTER 7: DEADLOCKS By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention
More informationDeadlocks. Deadlock Overview
Deadlocks Gordon College Stephen Brinton Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection
More informationOPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne
OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne 1 DEADLOCKS In a multi programming environment, several processes
More informationCOMPUTER SCIENCE 4500 OPERATING SYSTEMS
Last update: 2/23/2017 COMPUTER SCIENCE 4500 OPERATING SYSTEMS 2017 Stanley Wileman Module 7: Deadlocks In This Module 2! Deadlock: Definition and Examples! Deadlock: Models! Deadlock: Prevention Algorithms
More informationChapter 7: Deadlocks. Operating System Concepts 9 th Edition
Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection
More informationCSE 332: Locks and Deadlocks. Richard Anderson, Steve Seitz Winter 2014
CSE 332: Locks and Deadlocks Richard Anderson, Steve Seitz Winter 2014 1 Recall Bank Account Problem class BankAccount { private int balance = 0; synchronized int getbalance() { return balance; } synchronized
More informationDeadlocks Prof. James L. Frankel Harvard University. Version of 7:05 PM 7-Mar-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.
Deadlocks Prof. James L. Frankel Harvard University Version of 7:05 PM 7-Mar-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Introduction to Deadlocks Computer resources Files Database
More information