Chapter 6 Concurrency: Deadlock and Starvation

Size: px
Start display at page:

Download "Chapter 6 Concurrency: Deadlock and Starvation"

Transcription

1 Operating Systems: Internals and Design Principles Chapter 6 Concurrency: Deadlock and Starvation Seventh Edition By William Stallings Edited by Rana Forsati CSE410

2 Outline Principles of deadlock Deadlock prevention Deadlock avoidance Deadlock detection

3 The Deadlock Problem (I) The permanent blocking of a set of processes that either compete for a resource or communicate each other prevent sets of concurrent processes from completing their tasks

4 The Deadlock Problem (II) A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example 1 System has 2 disk drives P 1 and P 2 each hold one disk drive and each needs another one Example 2 semaphores A and B, both initialized to 1 P 0 P 1 wait (A); wait (B); wait(b) wait(a)

5 Deadlock and Dining Philosophers - Consider a proposal in which each philosopher is instructed to behave as follows: think until the left fork is available; when it is, pick it up; think until the right fork is available; when it is, pick it up; when both forks are held, eat for a fixed amount of time; then, put the right fork down; then, put the left fork down; repeat from the beginning. This attempted solution fails because it allows the system to reach a deadlock state, in which no progress is possible [ philosophers will die :-) ]. Wikipedia:

6 Deadlock Involve conflicting needs for resources by two or more processes Permanent: none of the process can continue execution No efficient solution

7 Resource Categories Reusable resource Consumable resource

8 Reusable Resources Used by one process at a time and not depleted by that use Processes obtain resources that they later release for reuse by other processes Processors, I/O channels, main and secondary memory, files, databases, and semaphores Deadlock occurs if each process holds one resource and requests the other Main focus in this course

9 Reusable Resource Deadlock 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

10 Consumable Resources Created (produced) and destroyed (consumed) by a process No limit on the number of consumable resources of one type 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

11 Resource Allocation Graphs deadlock deadlock-free

12 Four Conditions for Deadlock Deadlocks can arise if four conditions hold simultaneously: 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 other resources No preemption No resource can be forcibly removed from a process holding it Circular waiting - given that the first three conditions exist, a sequence of events may occur that lead to an unresolvable circular wait The first three conditions are necessary but not sufficient for a deadlock to exist. For deadlock to actually take place, circular waiting is required!

13 Circular Waiting The circular waiting condition is, actually, a potential consequence of the first three, and taken together, constitute necessary and sufficient conditions for deadlock A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain Circular wait: there exists a chain {P 0, P 1,,P N, P 0 } of waiting processes such that P 0 is waiting for a resource that is held by P 1, P 1 is waiting for a resource that is held by P 2,, P n 1 is waiting for a resource that is held by P n, and P n is waiting for a resource that is held by P 0.

14 Dealing with Deadlock Ensure that the system will never enter a deadlock state Deadlock Prevention methods Deadlock Avoidance methods Allow the system to enter a deadlock state and then recover Deadlock Detection method

15 Dealing with Deadlock Deadlock Prevention Adopting a policy that eliminates one of the conditions [aggressive] Deadlock Avoidance Making appropriate dynamic choices based on the current state of resource allocation [conservative] Deadlock Detection Detect deadlock and take action to recover [reasonable]

16 Outline Principles of deadlock Deadlock prevention Deadlock avoidance Deadlock detection

17 Deadlock Prevention Strategy Design a system in such a way that the possibility of deadlock is excluded. Two main methods: Indirect prevent the occurrence of one of the three necessary conditions Direct prevent the occurrence of a circular wait

18 Deadlock Prevention Elimination of Mutual Exclusion: if access to a resource requires mutual exclusion then it must be supported by the OS. Cannot be disallowed Elimination of Hold and Wait Can be prevented by A process requests all the required resources at one time Blocking the process until all requests can be granted simultaneously Problems: Inefficient A process maynot know in advance all resources it will require.

19 Deadlock Condition Prevention Elimination of No Preemption If a process holding certain resources is denied a further request, that process must release its original resources and request them again If a process requests a resource held by another process, OS may preempt the second process and require it to release its resources Only works when resource state can be saved and restored later.

20 Deadlock Condition Prevention With this rule, the resource allocation graph can never have a cycle. Elimination of Circular Wait Define a linear ordering of resource types If a process has been allocated resources of type R, then it may subsequently request only those resources of types following R in the ordering. May be inefficient, slowing down processes and denying resource access unnecessarily 1 Card reader 2 Printer 3 Plotter 4 Tape drive 5 Card punch Processes can request resources whenever they want to, but all requests must be made in numerical order. aggressive and is inefficient.

21 Outline Principles of deadlock Deadlock prevention Deadlock avoidance Deadlock detection

22 Deadlock Avoidance Can we guarantee that deadlocks will never occur? Allow the three necessary conditions but makes judicious choices to assure that the deadlock point is never reached A decision is made dynamically whether the current resource allocation request will, if granted, potentially lead to a deadlock Avoidance allows more concurrency than prevention. Requires knowledge of future process requests only works when resource state can be saved and restored later.

23 Deadlock Avoidance Referred to as the banker s algorithm Consider a system with a fixed number of processes and a fixed number of resources. At any time a process may have zero or more resources allocated to it. When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock. Safe state is where there is at least one sequence of resource allocations to all processes that does not result in a deadlock We are considering a worst-case situation here. Even in the worst case (process requests up their maximum at the moment), we don t have deadlock in a safe state. Unsafe state is a state that is not safe

24 Safe State More formally: A system state is safe if there exists a safe sequence of all processes (<P 1, P 2,, P n >) such that for each P i, the resources that P i can still request can be satisfied by currently available resources + resources held by all the P j, with j < i That is: If P i resource needs are not immediately available, then P i can wait until all P j have finished When P j is finished, P i can obtain needed resources, execute, return allocated resources, and terminate When P i terminates, P i +1 can obtain its needed resources, and so on.

25 Resource Allocation Denial If system is in safe state no deadlock If system is in unsafe state possibility of deadlock Avoidance ensure that system will never enter an unsafe state UNSAFE DEADLOCK SAFE Only with luck will processes avoid deadlock. O.S. can avoid deadlock.

26 The State of System There are n processes and m resources, and OS knows: Number of available instances of each resource For each process, current amount of each resource it owns For each process, maximum amount of each resource it might ever need declared in advance

27 Deadlock Avoidance: Assumptions When a request is done by a process for some resource(s): check before allocating resource(s); if it will leave the system in an unsafe state, then do not allocate the resource(s); process is waited and resources are not allocated to that process. The system knows the complete sequence of requests and releases for each process The system decides for each request whether or not the process should wait in order to avoid a deadlock Each process declare the maximum number of resources of each type that it may need in future The system should always be at a safe state Safe state no deadlock

28 Banker s Algorithm Key idea: ensure that the system of processes and resources is always in a safe state Mechanism: when a process makes a request for a set of resources Assume that the request is granted Update the system state accordingly Determine if the result is a safe state If so, grant he request; if not, block the process until it is safe to grant the request

29 Date Structure for Banker s Algorithm Resource or Existing-- vector representing the total number of each type of resource in the system Available -- vector representing the number of each type of resource not allocated to any process Claim or Max -- matrix representing the maximum number of each type of resource that each process may request Allocation -- matrix representing the number of each type of resource currently allocated to each process Need -- matrix representing the difference between the Claim and Allocation matrices Request -- vector representing a request for additional resources from a given process

30 An example system state All resources in the system Existing or Resource A B C Max A B C P P P P P Allocation A B C P P P P P system state at some t (may change) Need = Max - Allocation Need A B C P P P P P Available A B C 3 3 2

31 Notation X A B C P P P P P X is a matrix. X i is the i th row of the matrix: it is a vector. For example, X 3 = [2 1 1] Compare two vectors: Ex: compare V with X i V X i V A B C V is a vector; V = [3 3 2] V == X i? V <= X i? X i <= V?. Ex: Compare [3 3 2] with [2 2 1] [2 2 1] <= [3 3 2]

32 Resource-Request Algorithm for Process P i Request: request vector for process P i. If Request i [j] == k, then process P i wants k instances of resource type R j Algorithm 1. If Request i Need i go to step 2. Otherwise, raise error condition, since process has exceeded its maximum claim 2. If Request i Available, go to step 3. Otherwise P i must wait, since resources are not available

33 Resource-Request Algorithm for Process P i 3. Pretend to allocate requested resources to P i by modifying the state as follows: Available = Available Request i ; Allocation i = Allocation i + Request i ; Need i = Need i Request i ; Run the Safety Check Algorithm: If safe the requested resources are allocated to P i If unsafe The requested resources are not allocated to P i. P i must wait. The old resource-allocation state is restored.

34 Banker s Algorithm 1. If request[i] > need[i] then error (asked for too much) 2. If request[i] > available[i] then wait (can t supply it now) 3. Resources are available to satisfy the request Let s assume that we satisfy the request. Then we would have: available = available - request[i] allocation[i] = allocation [i] + request[i] need[i] = need [i] - request [i] Now, check if this would leave us in a safe state: if yes, grant the request, if no, then leave the state as is and cause process to wait.

35 Determination of a Safe State Initial State State of a system consisting of four processes and three resources Allocations have been made to the four processes

36 P2 Runs to Completion

37 P1 Runs to Completion

38 P3 Runs to Completion Thus, the state defined originally is a safe state

39 Example (I) of Banker s Algorithm We have the following system state: Need = Max - Allocation Max A B C Allocation A B C Need A B C Available A B C P P P P P P P P P P P P P P P Is it a safe state?

40 Example (I) of Banker s Algorithm Allocation A B C Need A B C Available A B C P P P P P P P P P P Try to find a row in Need i that is <= Available P1. run completion. Available becomes = [3 3 2] + [2 0 0] = [5 3 2] P3. run completion. Available becomes = [5 3 2] + [2 1 1] = [7 4 3] P4. run completion. Available becomes = [7 4 3] + [0 0 2] = [7 4 5] P2. run completion. Available becomes = [7 4 5] + [3 0 2] = [10 4 7] P0. run completion. Available becomes = [10 4 7] + [0 1 0] = [10 5 7] We found a sequence of execution: P1, P3, P4, P2, P0. State is safe

41 Example: P 1 requests (1,0,2) At that time Available is [3 3 2] First check that Request Available (that is, (1,0,2) (3,3,2) true. Then check the new state for safety: Max A B C Allocation A B C Need A B C Available A B C P P P P P P P P P P P P P P P new state (we did not go to that state yet; we are just checking)

42 Example: P 1 requests (1,0,2) Allocation A B C P P P P P Need A B C P P P P P Available A B C new state Can we find a sequence? Run P1. Available becomes = [5 3 2] Run P3. Available becomes = [7 4 3] Run P4. Available becomes = [7 4 5] Run P0. Available becomes = [7 5 5] Run P2. Available becomes = [10 5 7] Sequence is: P1, P3, P4, P0, P2 Yes, New State is safe. We can grant the request. Allocate desired resources to process P1.

43 P 4 requests (3,3,0)? Allocation A B C P P P P P Need A B C P P P P P Available A B C Current state If this is current state, what happens if P4 requests (3 3 0)? There is no available resource to satisfy the request. P4 will be waited.

44 P 0 requests (0,2,0)? Should we grant? Allocation A B C P P P P P Need A B C P P P P P Available A B C Current state System is in this state. P0 makes a request: [0, 2, 0]. Should we grant.

45 P 0 requests (0,2,0)? Should we grant? Assume we allocate 0,2,0 to P0. The new state will be as follows. Allocation A B C P P P P P Need A B C P P P P P Available A B C New state Is it safe? No process has a row in Need matrix that is less than or equal to Available. Therefore, the new state would be UNSAFE. Hence we should not go to the new state. The request is not granted. P0 is waited.

46 Example(II) of Banker s Algorithm

47 Example(II) of Banker s Algorithm

48 Example(II) of Banker s Algorithm

49 Example(II) of Banker s Algorithm

50 Banker s Algorithm n: integer # of processes m: integer # of resources available[1..m] - available[i] is # of avail resources of type i claim[1..n,1..m] - max demand of each Pi for each Ri allocation[1..n,1..m] - current allocation of resource Rj to Pi need[1..n,1..m] max # resource Rj that Pi may still request let request[i] be vector of # of resource Rj Process Pi wants

51 Banker s Algorithm 1. If request[i] > need[i] then error (asked for too much) 2. If request[i] > available[i] then wait (can t supply it now) 3. Resources are available to satisfy the request Let s assume that we satisfy the request. Then we would have: available = available - request[i] allocation[i] = allocation [i] + request[i] need[i] = need [i] - request [i] Now, check if this would leave us in a safe state: if yes, grant the request, if no, then leave the state as is and cause process to wait.

52 Deadlock Avoidance Advantages It is not necessary to preempt and rollback processes, as in deadlock detection It is less restrictive than deadlock prevention

53 Example (III) Assume we have the following resources: 5 tape drives 2 graphic displays 4 printers 3 disks We can create a vector representing our total resources: Total = (5, 2, 4, 3).

54 Example(III) Consider we have already allocated these resources among four processes as demonstrated by the following matrix Process Name Tape Drives Graphics Printers Disk Drives Process A Process B Process C Process D We also need a matrix to show the number of each resource still needed for each process; Process Name Tape Drives Graphics Printers Disk Drives Process A Process B Process C Process D Available = (1, 0, 2, 0). Question: Show that the sequence <D, A, B, C> safe state?

55 Deadlock Avoidance? Restrictions on its use: 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

56 Outline Principles of deadlock Deadlock prevention Deadlock avoidance Deadlock detection

57 Deadlock Strategies Deadlock prevention strategies are very conservative limit access to resources by imposing restrictions on processes Deadlock detection strategies do the opposite resource requests are granted whenever possible

58 Deadline Detection Algorithms Do not limit resource access or restrict process actions Requested resources are granted to processes whenever possible OS periodically performs detection algorithm Algorithm similar to that for detecting safe state can be used for deadlock detection as well. If deadlock is detected, it is fixed by OS!

59 Deadline Detection Algorithms A check for deadlock can be made as frequently as each resource request or, less frequently, depending on how likely it is for a deadlock to occur Advantages: it leads to early detection the algorithm is relatively simple Disadvantage frequent checks consume considerable processor time

60 Date Structure for Detection Algorithm Resource -- vector representing the total number of each type of resource in the system Available -- vector representing the number of each type of resource not allocated to any process Allocation -- matrix representing the number of each type of resource currently allocated to each process Request matrix representing the current request of each process

61 F: unmarked T: marked Example Marked = {F, F, F, F}; Available = (0, 0, 1); W is initialized to (0, 0, 1) R 1 R 2 R 3 P P P P Allocation A R 1 R 2 R 3 P P P P Request Q Q(P3) = (0, 0, 1) <= (0, 0, 1) = W

62 Example Marked = {F, F, T, F}; W = (1, 1, 1) = (0, 0, 1) + (1, 1, 0) R 1 R 2 R 3 P P P P Allocation A R 1 R 2 R 3 P P P 3 P Request Q

63 Example Marked = {F, F, T, T}; W = (2, 2, 2) = (1, 1, 1) + (1, 1, 1); R 1 R 2 R 3 P P P P Allocation A R 1 R 2 R 3 P P P 3 P 4 Request Q

64 Example Marked = {F, T, T, T}; W = (4, 3, 2) = (2, 2, 2) + (2, 1, 2); R 1 R 2 R 3 P P P P Allocation A R 1 R 2 R 3 P P 2 P 3 P 4 Request Q

65 Example Marked = {T, T, T, T}; W = (5, 4, 3) = (4, 3, 2) + (1, 1, 1); R 1 R 2 R 3 R 1 R 2 R 3 P P P P P 1 P 2 P 3 P 4 Allocation A Request Q

66 Detection Algorithm

67 Recovery Strategies Once deadlock has been detected, some strategy is needed for recovery. The following are possible approaches, listed in order of increasing sophistication: Abort all deadlocked processes Back up each deadlocked process to some previously defined checkpoint and restart all processes Successively abort deadlocked processes until deadlock no longer exists Successively preempt resources/processes until deadlock no longer exists Successively means an order is followed: least amount of CPU time consumed, lowest priority, least total resources allocated so far, etc.

68 Selection Criteria Deadlocked Processes Least amount of processor time consumed so far Least number of lines of output produced so far Most estimated time remaining Least total resources allocated so far Lowest priority

69 An Integrated Deadlock Strategy It might be more efficient for OS to use different strategies in different situations. One approach: Group resources into a number of different resource classes Use linear ordering strategy defined previously for the prevention of circular wait to prevent deadlocks between resources classes Within a resource class, use the algorithm that is most appropriate for that class

70 Deadlock: Summary the blocking of a set of processes that either compete for system resources or communicate with each other blockage is permanent unless OS takes action may involve reusable or consumable resources Consumable = destroyed when acquired by a process Reusable = not depleted/destroyed by use Dealing with deadlock: prevention guarantees that deadlock will not occur detection OS checks for deadlock and takes action avoidance analyzes each new resource request

ECE519 Advanced Operating Systems

ECE519 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 information

CSE 306/506 Operating Systems Deadlock. YoungMin Kwon

CSE 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 information

Chapter 7: Deadlocks. Operating System Concepts 8th Edition, modified by Stewart Weiss

Chapter 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 information

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Deadlock. 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

System Model. Types of resources Reusable Resources Consumable Resources

System 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 information

OPERATING SYSTEMS. Deadlocks

OPERATING 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 information

COP 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 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 information

Concurrency: Deadlock and Starvation. Chapter 6

Concurrency: Deadlock and Starvation. Chapter 6 Concurrency: Deadlock and Starvation Chapter 6 1 What is Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involve conflicting needs

More information

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

Operating 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 information

Chapter 6 Concurrency: Deadlock and Starvation

Chapter 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 information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009!

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling

More information

CSC 539: Operating Systems Structure and Design. Spring 2005

CSC 539: Operating Systems Structure and Design. Spring 2005 CSC 539: Operating Systems Structure and Design Spring 2005 Process deadlock deadlock prevention deadlock avoidance deadlock detection recovery from deadlock 1 Process deadlock in general, can partition

More information

UNIT-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. 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 information

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian

ICS 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 information

Concurrency: Deadlock and Starvation. Chapter 6

Concurrency: 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 information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 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 information

Chapter 7: Deadlocks

Chapter 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 information

Lecture 7 Deadlocks (chapter 7)

Lecture 7 Deadlocks (chapter 7) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 7 Deadlocks (chapter 7) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are

More information

Chapter 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 Deadlock Chapter

More information

Contents. Chapter 8 Deadlocks

Contents. 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 information

Deadlock 1 Chapter 6

Deadlock 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 information

Bridge Crossing Example

Bridge Crossing Example CSCI 4401 Principles of Operating Systems I Deadlocks Vassil Roussev vassil@cs.uno.edu Bridge Crossing Example 2 Traffic only in one direction. Each section of a bridge can be viewed as a resource. If

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 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 information

The Deadlock Problem

The 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 information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Part II Process M anagement Management Chapter 7: Deadlocks Fall 2010

Part II Process M anagement Management Chapter 7: Deadlocks Fall 2010 Part II Process Management Chapter 7: Deadlocks Fall 2010 1 System Model System resources are utilized in the following way: Request: If a process makes a request to use a system resource which cannot

More information

Chapter 8: Deadlocks

Chapter 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 information

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization

Chapter 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 information

The Deadlock Problem

The 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 information

Deadlocks. Prepared By: Kaushik Vaghani

Deadlocks. Prepared By: Kaushik Vaghani Deadlocks Prepared By : Kaushik Vaghani Outline System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection & Recovery The Deadlock Problem

More information

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks

Chapter 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 information

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model

Module 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 information

Deadlock 1 Chapter 6

Deadlock 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 information

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example

Chapter 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 information

CMSC 412. Announcements

CMSC 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 information

The Deadlock Problem (1)

The 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 information

Deadlock and Starvation

Deadlock 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 information

Deadlock and Starvation

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

More information

Chapter 7: Deadlocks

Chapter 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 information

Module 6: Deadlocks. Reading: Chapter 7

Module 6: Deadlocks. Reading: Chapter 7 Module 6: Deadlocks Reading: Chapter 7 Objective: To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods

More information

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005 Deadlocks Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Silberschatz,

More information

Chapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14

Chapter 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 information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem 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 information

Deadlocks. Deadlock Overview

Deadlocks. 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 information

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices! " Silberschatz, Galvin and Gagne 2013!

Silberschatz, 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 information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem 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 information

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph 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 information

Deadlocks. Dr. Yingwu Zhu

Deadlocks. 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 information

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition

Chapter 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 information

Module 7: Deadlocks. The Deadlock Problem

Module 7: Deadlocks. The Deadlock Problem Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Principles of Operating Systems

Principles 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 information

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.

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. Deadlock 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 semaphores A and B, initialized to 1 P 0 P

More information

CS420: Operating Systems. Deadlocks & Deadlock Prevention

CS420: 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 information

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University. Deadlocks Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University msryu@hanyang.ac.kr Topics Covered System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention

More information

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Deadlock. Chapter Objectives

Deadlock. Chapter Objectives Deadlock This chapter will discuss the following concepts: The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Deadlocks. System Model

Deadlocks. System Model Deadlocks System Model Several processes competing for resources. A process may wait for resources. If another waiting process holds resources, possible deadlock. NB: this is a process-coordination problem

More information

Resource Management and Deadlocks 1

Resource Management and Deadlocks 1 Resource Management and Deadlocks 1 The Deadlock Problem Law passed by the Kansas Legislature in early 20th century: When two trains approach each other at a crossing, both shall come to a full stop and

More information

Chapter 8: Deadlocks. Bridge Crossing Example. The Deadlock Problem

Chapter 8: Deadlocks. Bridge Crossing Example. The Deadlock Problem Chapter 8: Deadlocks Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 8.1 Bridge Crossing Example Bridge has one

More information

Principles of Operating Systems

Principles 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 information

Chapter 8: Deadlocks. Operating System Concepts with Java

Chapter 8: Deadlocks. Operating System Concepts with Java 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 information

CHAPTER 7 - DEADLOCKS

CHAPTER 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 information

Concurrency: Deadlock and Starvation

Concurrency: 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 information

The Deadlock Problem

The 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 information

CSE Opera+ng System Principles

CSE Opera+ng System Principles CSE 30341 Opera+ng System Principles Deadlocks Overview System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 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 information

System Model. Deadlocks. Deadlocks. For example: Semaphores. Four Conditions for Deadlock. Resource Allocation Graph

System Model. Deadlocks. Deadlocks. For example: Semaphores. Four Conditions for Deadlock. Resource Allocation Graph System Model Deadlocks There are non-shared computer resources Maybe more than one instance Printers, Semaphores, Tape drives, CPU Processes need access to these resources Acquire resource If resource

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013!

Chapter 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 information

CS307 Operating Systems Deadlocks

CS307 Operating Systems Deadlocks CS307 Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Bridge Crossing Example Traffic only in one direction Each section of a bridge can be viewed

More information

Last Class: Synchronization Problems!

Last 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 information

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model CS07 Bridge Crossing Example Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Traffic only in one direction Each section of a bridge can be viewed

More information

University of Babylon / College of Information Technology / Network Department. Operating System / Dr. Mahdi S. Almhanna & Dr. Rafah M.

University of Babylon / College of Information Technology / Network Department. Operating System / Dr. Mahdi S. Almhanna & Dr. Rafah M. Chapter 6 Methods for Handling Deadlocks Generally speaking, we can deal with the deadlock problem in one of three ways: We can use a protocol to prevent or avoid deadlocks, ensuring that the system will

More information

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example

Deadlock. 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 information

Deadlock and Starvation

Deadlock and Starvation Chapter 6 Deadlock and Starvation We now look into two more issues that make concurrent processing so much more difficult: deadlock and starvation. We will look at the problems first, and discuss a few

More information

Operating System: Chap7 Deadlocks. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap7 Deadlocks. National Tsing-Hua University 2016, Fall Semester Operating System: Chap7 Deadlocks National Tsing-Hua University 2016, Fall Semester Overview System Model Deadlock Characterization Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from

More information

Chapters 5 and 6 Concurrency

Chapters 5 and 6 Concurrency Operating Systems: Internals and Design Principles, 6/E William Stallings Chapters 5 and 6 Concurrency Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Concurrency When several processes/threads

More information

Deadlock 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. 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 information

Introduction to OS. Deadlock. MOS Ch. 6. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Introduction to OS. Deadlock. MOS Ch. 6. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1 Introduction to OS Deadlock MOS Ch. 6 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Outline What is Deadlock? How to handle Deadlock? Deadlock Detection and Recovery

More information

Deadlocks. The Deadlock Problem. Bridge Crossing Example. Topics

Deadlocks. The Deadlock Problem. Bridge Crossing Example. Topics Deadlocks Topics - System Model - Deadlock characterization - Methods for handling deadlocks - Deadlock prevention,avoidance - Deadlock detection and recovery The Deadlock Problem - A set of blocked processes

More information

CHAPTER 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 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 information

Deadlocks: Part I Prevention and Avoidance Yi Shi Fall 2017 Xi an Jiaotong University

Deadlocks: Part I Prevention and Avoidance Yi Shi Fall 2017 Xi an Jiaotong University Deadlocks: Part I Prevention and Avoidance Yi Shi Fall 2017 Xi an Jiaotong University Review: Motivation for Monitors and Condition Variables Semaphores are a huge step up, but: They are confusing because

More information

Operating systems. Lecture 5. Deadlock: System Model. Deadlock: System Model. Process synchronization Deadlocks. Deadlock: System Model

Operating systems. Lecture 5. Deadlock: System Model. Deadlock: System Model. Process synchronization Deadlocks. Deadlock: System Model Lecture 5 Operating systems Process synchronization Deadlocks Deadlock: System Model Computer system: Processes (program in execution); Resources (CPU, memory space, files, I/O devices, on so on). Deadlock:

More information

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

CSCE Operating Systems Deadlock. Qiang Zeng, Ph.D. Fall 2018 CSCE 311 - Operating Systems Deadlock Qiang Zeng, Ph.D. Fall 2018 Previous Class What is Deadlock? How to detect it? Dealing with deadlock: Prevention Avoidance Detection CSCE 311 Operating Systems 2 Outline

More information

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01 1 Unit-03 Deadlock and Memory Management Unit-03/Lecture-01 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.

More information

Roadmap. Deadlock Prevention. Deadlock Prevention (Cont.) Deadlock Detection. Exercise. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012

Roadmap. Deadlock Prevention. Deadlock Prevention (Cont.) Deadlock Detection. Exercise. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012 CSE 421/521 - Operating Systems Fall 2012 Roadmap Lecture - XI Deadlocks - II Deadlocks Deadlock Prevention Deadlock Detection Deadlock Recovery Deadlock Avoidance Tevfik Koşar University at Buffalo October

More information

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

CSCC 69H3 2/1/13. Today: Deadlock. Remember example from last week? Example of Deadlock. Example: dining philosophers: Not just an OS Problem! 2/1/13 Today: Deadlock CSCC 69H3 Operating Systems Winter 2013 Professor Bianca Schroeder U of T Remember example from last week? My_work(id_t id) { /* id can be 0 or 1 */ flag[id] = true; /* indicate

More information

The deadlock problem

The 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 information

Deadlock Risk Management

Deadlock 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 information

OPERATING 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. 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 information

Deadlock. Operating Systems. Autumn CS4023

Deadlock. Operating Systems. Autumn CS4023 Operating Systems Autumn 2017-2018 Outline Deadlock 1 Deadlock Outline Deadlock 1 Deadlock The Deadlock Problem Deadlock A set of blocked processes each holding a resource and waiting to acquire a resource

More information

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.

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. 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 information

Deadlocks Detection and Avoidance. Prof. Sirer CS 4410 Cornell University

Deadlocks Detection and Avoidance. Prof. Sirer CS 4410 Cornell University Deadlocks Detection and Avoidance Prof. Sirer CS 4410 Cornell University System Model There are non-shared computer resources Maybe more than one instance Printers, Semaphores, Tape drives, CPU Processes

More information

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

Concurrency: 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 information

Basic concepts and Terminologies

Basic concepts and Terminologies Deadlock Basic Terminology & Definitions Deadlock, livelock, starvation, resource allocation graph Conditions To Deadlock, Approaches To Deadlock Mutual exclusion, hold and wait, no preemption, circular

More information

Deadlocks. Mehdi Kargahi School of ECE University of Tehran Spring 2008

Deadlocks. Mehdi Kargahi School of ECE University of Tehran Spring 2008 Deadlocks Mehdi Kargahi School of ECE University of Tehran Spring 2008 What is a Deadlock Processes use resources in the following sequence: Request Use Release A number of processes may participate in

More information

Chapter - 4. Deadlocks Important Questions

Chapter - 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 information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 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 information

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

Last 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 information

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

Operating 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 information