Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Operating System: DEADLOCKS SONALI C. BSc (IT) UDIT Deadlocks-Galvin sonali C.
What is Deadlock? 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 disk drive and each needs another one. Example  2 train approaches each other at crossing, both will come to full stop and neither shall start until other has gone.  Deadlocks-Galvin sonali C.
Deadlock Example Traffic only in one direction. Each section of a bridge can be viewed as a resource. If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback). Several cars may have to be backed up if a deadlock occurs. Starvation is possible  Deadlocks-Galvin sonali C.
What are we covering? 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 or avoiding deadlocks in a computer system. Deadlocks-Galvin sonali C.

Recommended for you

Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization

Critical Section Problem, Synchronization Hardware, Mutex, Semaphore, Monitor, Classic problems in Synchronization

critical section problemsynchronization hardwaremutex
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems

Deadlocks-An Unconditional Waiting Situation in Operating System. We must make sure of This concept well before understanding deep in to Operating System. This PPT will understands you to get how the deadlocks Occur and how can we Detect, avoid and Prevent the deadlocks in Operating Systems.

deadlocksdeadlock avoidancedeadlock prevention
Deadlock
DeadlockDeadlock
Deadlock

this ppt is about deadlock - system model , methods of handling deadlock, deadlock avoidance, recovery from deadlock, deadlock detection

deadlockwhat is deadlocksystem model
SYSTEM MODEL Each resource type  R i  has  W i  instances. Resource types  R 1 ,  R 2 , . . .,  R m CPU cycles, memory space, I/O devices System has 2 CPUs, then resource type CPU has 2 instance. Each process utilizes a resource as follows: request  (system call) use  release  (system call) Deadlocks-Galvin sonali C.
DEADLOCK CHARACTERIZATION Deadlock can arise if four conditions hold simultaneously. Mutual exclusion:   only one process at a time can use a resource. Hold and wait:   a process holding at least one resource is waiting to acquire additional resources held by other processes. Deadlocks-Galvin sonali C.
No preemption:   a resource can be released only voluntarily by the process holding it, after that process has completed its task. Circular wait:   there exists a set { P 0 ,  P 1 , …,  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 0  is waiting for a resource that is held by  P 0 . Deadlocks-Galvin sonali C. CONT…
RESOURCE-ALLOCATION  GRAPH Deadlocks can be described in term of directed graph-  SYSTEM RESOURCE-ALLOCATION GRAPH . A set of vertices  V  and a set of edges  E . V is partitioned into two types: P  = { P 1 ,  P 2 , …,  P n }, the set consisting of all the processes in the system. R  = { R 1 ,  R 2 , …,  R m }, the multi-set consisting of all resource types in the system. request edge – directed edge  P 1     R j assignment edge – directed edge  R j      P i Deadlocks-Galvin sonali C.

Recommended for you

deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYdeadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

This document discusses deadlock detection in distributed systems. It defines deadlock as when a set of processes are permanently blocked waiting for resources held by each other. There are four conditions for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Deadlock can be detected using centralized, hierarchical, or distributed approaches. Goldman's distributed algorithm avoids maintaining a continuous wait-for graph by exchanging blocked process lists to detect cycles that indicate deadlocks.

deadlock detectiondeadlockcentalized
Deadlock
DeadlockDeadlock
Deadlock

This document discusses deadlocks in operating systems. It defines deadlock as when multiple processes are waiting for resources held by each other in a cyclic manner, resulting in none of the processes making progress. It provides examples and describes the four necessary conditions for deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. It also discusses methods for handling deadlocks, including prevention, avoidance, and recovery techniques like terminating processes or preempting resources.

deadlock
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems

The document discusses deadlocks in computing systems. It defines deadlocks and related concepts like livelock and starvation. It presents various approaches to deal with deadlocks including detection and recovery, avoidance through runtime checks, and prevention by restricting resource requests. Graph-based algorithms are described for detecting and preventing deadlocks by analyzing resource allocation graphs. The Banker's algorithm is introduced as a static prevention method. Finally, it discusses ways to eliminate the conditions required for deadlocks, like mutual exclusion, hold-and-wait, and circular wait.

deadlock detection in distributed systems
RESOURCE-ALLOCATION  GRAPH Process Resource Type with 4 instances P i   requests instance of  R j P i  is holding an instance of  R j Deadlocks-Galvin sonali C. CONT… P i P i R j R j
EXAMPLE OF RESOURCE-ALLOCATION GRAPH Deadlocks-Galvin sonali C. CONT…
RESOURCE-ALLOCATION GRAPH WITH A DEADLOCK P1 -> R1 -> P2 -> R3 -> P3 -> R2 -> P1  P2 -> R3 -> P3 -> R2 -> P1  Deadlocks-Galvin sonali C. CONT…
GRAPH WITH A CYCLE BUT NO DEADLOCK P1 -> R1 -> P3 -> R2 -> P1 No deadlock P4  may release its instance of resource R2 Then it can be allocated to P3 Deadlocks-Galvin sonali C. CONT…

Recommended for you

Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System

In these slides I discussed about deadlock,causes of deadlock,effects of deadlock,conditions of deadlock,resource allocation graph,deadlock handling strategies,deadlock prevention,deadlock avoidance,deadlock avoidance and resolution....I haven't touch algorithms section in these slides.....and last thing I want to say that don't forget to follow me...

 
by AUST
deadlockconditions of deadlockcauses of deadlock
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS

There are three main methods for dealing with deadlocks in an operating system: prevention, avoidance, and detection with recovery. Prevention ensures that the necessary conditions for deadlock cannot occur through restrictions on resource allocation. Avoidance uses additional information about future resource needs and requests to determine if allocating resources will lead to an unsafe state. Detection identifies when a deadlock has occurred, then recovery techniques like process termination or resource preemption are used to resolve it. No single approach is suitable for all resource types, so systems often combine methods by applying the optimal one to each resource class.

CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation

CPU scheduling allows processes to share the CPU by pausing execution of some processes to allow others to run. The scheduler selects which process in memory runs on the CPU. There are four types of scheduling decisions: when a process pauses for I/O, switches from running to ready, finishes I/O, or terminates. Scheduling can be preemptive, where a higher priority process interrupts a running one, or non-preemptive. Common algorithms are first come first serve, shortest job first, priority, and round robin. Real-time scheduling aims to process data without delays and ensures the highest priority tasks run first.

If graph contains no cycles    no deadlock. If graph contains a cycle   if only one instance per resource type, then deadlock. if several instances per resource type, possibility of deadlock. RESOURCE-ALLOCATION  GRAPH Deadlocks-Galvin sonali C. CONT…
METHODS FOR HANDLING DEADLOCK We can deal with DL problem in 3-ways: Prevention/Avoidance Ensure that the system will  never   enter a deadlock state. Detection/Correction Allow system to enter a deadlock state and then recover. Ignorance  Ignore problem and pretend that deadlocks never occur Used by most operating systems, including UNIX . Deadlocks-Galvin sonali C.
METHODS FOR HANDLING DEADLOCK Prevention Set of methods for ensuring that at least one of the condition cannot hold. Avoidance OS  be given information about the resources request used in advance Deadlocks-Galvin sonali C. CONT…
DEADLOCK PREVENTION Restrain the ways request can be made. Mutual Exclusion  – not required for sharable resources; must hold for non-sharable resources. A printer cannot simultaneously shared by several process Deadlocks-Galvin sonali C.

Recommended for you

5 process synchronization
5 process synchronization5 process synchronization
5 process synchronization

This chapter discusses process synchronization and solving the critical section problem. It introduces Peterson's solution to the critical section problem and other synchronization methods like mutex locks, semaphores, and monitors. Classical synchronization problems covered include the bounded buffer problem, dining philosophers problem, and readers-writers problem. The chapter aims to present concepts of process synchronization and tools to solve synchronization issues.

osoperating systemprocess synchronization
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System

Deadlock occurs when two or more competing processes are each waiting for resources held by the other, resulting in all processes waiting indefinitely. There are four conditions required for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Techniques to prevent deadlock include attacking each condition: allowing some resources to be shared, requiring processes request all resources at start, allowing preemption of resources, and imposing a global numbering on resource requests.

deadlockdeadlock characteristicsdeadlock definition
deadlock handling
deadlock handlingdeadlock handling
deadlock handling

The document discusses deadlocks in database systems. It defines deadlock as a waiting state where transactions are unable to progress because each is holding a resource needed by another, forming a cyclic dependency. It outlines the four conditions for deadlock - mutual exclusion, hold and wait, no preemption, and circular wait. Methods for handling deadlocks include avoidance, prevention, detection and recovery. Prevention techniques involve locking protocols or transaction rollback with timestamps. Detection uses a wait-for graph to identify cycles indicating deadlocks, and recovery requires selecting victims to rollback to break cycles.

DEADLOCK PREVENTION Hold and Wait  – must guarantee that whenever a process requests a resource, it does not hold any other resources. Require process to request and be allocated all its resources before it begins execution Or…allow process to request resources only when the process has none. Cons: Lower resource utilization Starvation  Deadlocks-Galvin sonali C. CONT…
DEADLOCK PREVENTION No Preemption  – If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are released. Preempted resources are added to the list of resources for which the process is waiting. Process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting. If process is requesting another resource, if it is available then it is given to requesting process If it is held by another process which is waiting for another resource, we release it n give it to requesting process. Deadlocks-Galvin sonali C. CONT…
DEADLOCK PREVENTION Circular Wait  – impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration.   Deadlocks-Galvin sonali C. CONT…
DEADLOCK AVOIDANCE Requires additional information about how resources are to be used. Simplest and most useful model requires that each process declare the  maximum number  of resources of each type that it may need. The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. Resource-allocation  state  is defined by the number of available and allocated resources, and the maximum demands of the processes. Deadlocks-Galvin sonali C.

Recommended for you

Chapter 7
Chapter 7Chapter 7
Chapter 7

This document summarizes key concepts from Chapter 7 of the textbook Operating System Concepts by Silberschatz, Galvin and Gagne. It discusses deadlocks in computer systems, including their characterization and conditions for their occurrence. It also describes several approaches for handling deadlocks, such as prevention, avoidance, detection and recovery methods. The resource allocation graph and banker's algorithm are presented as techniques for deadlock avoidance when multiple instances of resources are present.

operating system
Bankers
BankersBankers
Bankers

Deadlocks occur when a set of blocked processes each hold resources and wait for resources held by other processes in the set, resulting in a circular wait. The four necessary conditions for deadlock are: mutual exclusion, hold and wait, no preemption, and circular wait. The banker's algorithm is a deadlock avoidance technique that requires processes to declare maximum resource needs upfront. It ensures the system is always in a safe state by delaying resource requests that could lead to an unsafe state where deadlock is possible.

Deadlock Presentation
Deadlock PresentationDeadlock Presentation
Deadlock Presentation

Salman Ahmed presents on deadlocks in computer systems. A deadlock occurs when two programs are preventing each other from accessing shared resources, causing both programs to cease functioning. Deadlocks happen when processes are holding resources and waiting to acquire more resources, but cannot release the initial resources. There are four main approaches to handling deadlocks: prevention, avoidance, detection, and recovery. Prevention eliminates one of the conditions required for a deadlock, while avoidance allows the system to refuse resource requests to avoid entering a deadlocked state.

deadlockcseoperating system
SAFE STATE When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. Systems is in safe state if there exists a safe sequence of all process A sequence < P 1 , P 2 , …, P n > of ALL the  processes  is the system 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 . Deadlocks-Galvin sonali C.
SAFE STATE 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.  Deadlocks-Galvin sonali C. CONT…
SAFE, UNSAFE  DEADLOCK STATE If system is in safe state => No deadlock If system in not in safe state => possibility of deadlock OS cannot prevent processes from requesting resources in a sequence that leads to deadlock Avoidance => ensue that system will never enter an unsafe state, prevent getting into deadlock Deadlocks-Galvin sonali C. CONT…
SAFE STATE - Example Suppose processes P0, P1, and P2 share 12 magnetic tape drives Currently 9 drives are held among the processes and 3 are available Question: Is this system currently in a safe state? Answer: Yes!  Safe Sequence: <P1, P0, P2> Deadlocks-Galvin sonali C. CONT…

Recommended for you

Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems

The document discusses deadlocks in operating systems. It defines deadlock as a situation where a set of processes are blocked waiting for resources held by other processes in the set, resulting in none of the processes making any progress. Four conditions must be met for deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. The document presents examples to illustrate deadlock and discusses different strategies for dealing with it, including deadlock prevention, avoidance, and detection and recovery. It specifically describes the Banker's Algorithm for deadlock avoidance.

Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock

Deadlock is a very important topic in operating system. In this presentation slide, try to relate deadlock with real life scenario and find out some solution with two main algorithm- Safety and Banker's Algorithm.

deadlockoperating system presentationbanker's algorithm
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system

This document discusses deadlocks in operating systems. A deadlock occurs when a set of processes are blocked waiting for resources held by each other in a cyclic manner. Four conditions must be met for a deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. The document outlines strategies for detecting and avoiding deadlocks such as deadlock detection algorithms, safe state models like the Banker's Algorithm, and techniques for preventing the four deadlock conditions.

deadlocks in operating system
System in UNSAFE STATE Suppose process P2 requests and is allocated 1 more tape drive. Question: Is the resulting state still safe? Answer: No! Because there does not exist a safe sequence anymore. Only P1 can be allocated its maximum needs. IF  P0 and P2 request 5 more drives and 6 more drives, respectively, then the resulting state will be deadlocked. Deadlocks-Galvin sonali C. CONT… 3
SAFE STATE - DEADLOCK AVOIDANCE Key Ideas: Initially the system is in a safe state Whenever a process requests an available resource, system will allocate resource immediately only if the resulting state is still safe! Otherwise, requesting process must wait.  Deadlocks-Galvin sonali C. CONT…
DEADLOCK AVOIDANCE ALGORITHM Single instance of a resource type .  Use a  resource-allocation graph Cycles are necessary are sufficient for deadlock Multiple instances of a resource type.   Use the  banker’s algorithm Cycles are necessary, but not sufficient for deadlock Deadlocks-Galvin sonali C.
RESOURCE ALLOCATION GRAPH ALGORITHM Claim edge   P i      R j  indicates that process  P j  may request resource  R j ; represented by a dashed line. Claim edge converts to request edge when a process requests a resource. Request edge converted to an assignment edge when the  resource is allocated to the process. When a resource is released by a process, assignment edge reconverts to a claim edge. Resources must be claimed  a priori  in the system. Deadlocks-Galvin sonali C.

Recommended for you

Intro to Deadlocks
Intro to DeadlocksIntro to Deadlocks
Intro to Deadlocks

This document discusses deadlocks in database systems. It explains that deadlocks occur when two or more competing actions get stuck waiting on each other to finish. It then provides an example of a deadlock between two dogs, Tony and Jake, fighting over bones. It demonstrates how to detect and debug deadlocks using MySQL status commands and log files. Finally, it offers best practices like defining proper indexes to avoid deadlocks and handling them through retry logic or manual locking.

railsmysqllock
Deadlock
DeadlockDeadlock
Deadlock

Shivangi submitted a document on deadlocks to Tapas Sangiri. The 3-sentence summary is: The document discusses different aspects of deadlocks including definitions, characteristics, methods for handling them such as prevention, avoidance and recovery. Prevention methods aim to ensure a deadlock never occurs by restricting resource allocation in different ways. Avoidance algorithms analyze the resource allocation graph to determine if a system is in a safe state to avoid deadlocks.

Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt

This document discusses deadlocks, including the four conditions required for a deadlock, methods to avoid deadlocks like using safe states and Banker's Algorithm, ways to detect deadlocks using wait-for graphs and detection algorithms, and approaches to recover from deadlocks such as terminating processes or preempting resources.

RESOURCE ALLOCATION  GRAPH ALGORITHM P2 requesting R1, but R1 is already allocated to P1. Both processes have a claim on resource R2 What happens if P2 now requests resource R2? Deadlocks-Galvin sonali C. CONT…
UNSAFE STATE IN RESOURCE ALLOCATIONGRAPH ALGORITHM Cannot allocate resource R2 to process P2 Why? Because resulting state is unsafe P1 could request R2, thereby creating deadlock! Deadlocks-Galvin sonali C. CONT…
RESOURCE ALLOCATION  GRAPH ALGORITHM Use only when there is a single instance of each resource type Suppose that process  P i  requests a resource  R j The request can be granted only if converting the request edge to an assignment edge does not result in the formation of a cycle in the resource allocation graph. Here we check for safety by using cycle-detection algorthim. Deadlocks-Galvin sonali C. CONT…
BANKER’S ALGORITHM RAL is not applicable for multiple instance of resource Bankers’ algorithm - Multiple instances. Each process claims maximum resource needs  a priori . When a process requests a resource it may have to wait.  When a process gets all of its resources it must return them in a finite amount of time. Deadlocks-Galvin sonali C.

Recommended for you

Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution

This presentation about Gary L. Peterson's critical section problem solution. this file also provide Java source code to solve.

Deadlock
DeadlockDeadlock
Deadlock

The document discusses deadlock in computer systems. It defines deadlock and lists necessary conditions for deadlock including mutual exclusion, hold and wait, no preemption, and circular wait. It also discusses strategies for dealing with deadlock such as detection, recovery, and prevention/avoidance. The resource allocation graph (RAG) model is introduced as a way to represent system states and detect deadlock. Algorithms like Banker's algorithm aim to avoid deadlock by ensuring safe allocation of resources.

Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section

The document discusses solutions to the critical section problem where multiple processes need exclusive access to shared resources. It defines the critical section problem and requirements for a solution. It then presents three algorithms using shared variables to coordinate access between two processes in a way that satisfies mutual exclusion, progress, and bounded waiting.

BANKER’S ALGORITHM -Data structure Let,  n  = number of processes m  = number of resources types Available :   Vector of length  m . If Available[ j ] =  k , there are  k  instances of resource type  R j   available. Max : n x m  matrix.  If  Max  [ i,j ] =  k , then process  P i   may request at most  k  instances of resource type  R j . Allocation :  n  x  m  matrix.  If Allocation[ i,j ] =  k  then  P i  is currently allocated  k  instances of  R j. Need :  n  x  m  matrix. If  Need [ i,j ] =  k , then  P i  may need  k  more instances of  R j   to complete its task. Need  [ i,j]  =  Max [ i,j ] –  Allocation  [ i,j ]. Deadlocks-Galvin sonali C. CONT…
BANKER’S ALGORITHM - Safety Algorithm 1. Let  Work   and  Finish  be vectors of length  m  and  n , respectively.  Initialize: Work  =  Available Finish  [ i ] =  false  for  i  = 0, 1, …,  n-  1 . 2. Find and  i  such that both:  (a)  Finish  [ i ] =  false (b)  Need i      Work If no such  i  exists, go to step 4. 3. Work  =  Work  +  Allocation i Finish [ i ] =  true go to step 2. 4. If  Finish  [ i ] == true for all  i , then the system is in a safe state. Deadlocks-Galvin sonali C. CONT…
BANKER’S ALGORITHM - Resource Allocation Algorithm Request  = request vector for process  P i .  If  Request i   [ j ] =  k  then process  P i  wants  k  instances of resource type  R j . 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. 3. Pretend to allocate requested resources to  P i  by modifying the state as follows: Available  =  Available  –  Request; Allocation i   =  Allocation i  +  Request i ; Need i   =  Need i  –  Request i ; If safe    the resources are allocated to Pi.  If unsafe    Pi must wait, and the old resource-allocation state is restored Deadlocks-Galvin sonali C. CONT…
BANKER’S ALGORITHM - Example 5 processes  P 0  through  P 4 ;  3 resource types: A  (10 instances),  B  (5instances), and  C  (7 instances). Snapshot at time  T 0 : Allocation Max Available A B C A B C  A B C P 0 0 1 0 7 5 3  3 3 2   P 1 2 0 0  3 2 2    P 2 3 0 2  9 0 2   P 3 2 1 1  2 2 2   P 4 0 0 2 4 3 3  Deadlocks-Galvin sonali C. CONT…

Recommended for you

Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232

This document outlines the key aspects of deadlocks in operating systems. It defines the necessary conditions for a deadlock to occur as mutual exclusion, hold and wait, no preemption, and circular wait. A resource-allocation graph is used to model resource usage, where a cycle indicates a potential deadlock. Deadlocks can be prevented by avoiding one of the necessary conditions, or can be detected using the graph model to identify cycles. Upon detection, processes may need to be terminated or have resources preempted to recover from the deadlock.

Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt

This document discusses deadlocks in operating systems. It defines deadlock as when a set of blocked processes each hold a resource and wait for a resource held by another process. It then covers methods for handling deadlocks such as prevention, avoidance, detection, and recovery. Prevention ensures deadlock conditions cannot occur. Avoidance allows the system to deny requests that could lead to deadlock. Detection identifies when a deadlock has occurred. Recovery breaks deadlocks by terminating or preempting processes.

ppt_by_niveditadeadlock_gp_1242_007ppt_by_anusha
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)

This document discusses different approaches to handling deadlocks in operating systems, including prevention, avoidance, detection, and recovery. Deadlock prevention methods restrain how processes request resources to ensure deadlocks cannot occur. Deadlock avoidance uses information about maximum resource needs to dynamically monitor the system's allocation state and ensure it never enters an unsafe state where deadlock is possible. The Banker's Algorithm is presented as a deadlock avoidance technique that models the system and checks if allocating resources leaves the system in a safe state.

BANKER’S ALGORITHM - Example cont… The content of the matrix  Need  is defined to be  Max  –  Allocation . Need A B C   P 0 7 4 3    P 1 1 2 2    P 2 6 0 0    P 3 0 1 1   P 4 4 3 1  The system is in a safe state since the sequence <  P 1 ,  P 3 ,  P 4 ,  P 2 ,  P 0 > satisfies safety criteria.  Deadlocks-Galvin sonali C. CONT…
BANKER’S ALGORITHM - Example cont…(P1 Request (1,0,2)) Check that Request    Available (that is, (1,0,2)    (3,3,2)    true . Allocation Need Available A B C A B C A B C  P 0 0 1 0  7 4 3  2 3 0 P 1 3 0 2 0 2 0  P 2 3 0 1  6 0 0  P 3 2 1 1  0 1 1 P 4 0 0 2  4 3 1  Executing safety algorithm shows that sequence <  P 1 ,  P 3 ,  P 4 ,  P 0 ,  P 2 > satisfies safety requirement.  Can request for (3,3,0) by  P 4  be granted? –NO  Can request for (0,2,0) by  P 0  be granted? –NO ( Results Unsafe) Deadlocks-Galvin sonali C. CONT…
DEADLOCK DETECTION Allow system to enter deadlock state  Detection algorithm Recovery scheme Deadlocks-Galvin sonali C.
Resource-Allocation Graph and Wait-for Graph For single instance P i  -> P j  (P i  is waiting for P j  to release a resource that P i  needs) P i   -> P j  exist if and only if RAG contains 2 edges P i  -> R q  and R q  -> P j  for some resource R q Deadlocks-Galvin sonali C. Resource-Allocation  Graph Corresponding  wait-for graph

Recommended for you

Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal

This document outlines different methods for handling deadlocks in operating systems, including deadlock prevention, avoidance, detection, and recovery. It discusses the four necessary conditions for deadlock and defines a resource-allocation graph model. For deadlock prevention, it describes ways to ensure that the mutual exclusion, hold and wait, no preemption, and circular wait conditions cannot simultaneously hold through protocols like requesting all resources at start, releasing resources before requesting new ones, preempting held resources, and imposing a total ordering of resource types. Deadlock avoidance uses additional process information to decide if a request should wait. Detection identifies deadlocks in the system state, while recovery terminates processes or preempts resources.

Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456

This document outlines different methods for handling deadlocks in operating systems, including deadlock prevention, avoidance, detection, and recovery. It discusses the four necessary conditions for deadlock and introduces the concept of a resource-allocation graph. For deadlock prevention, it describes ways to ensure that the conditions of mutual exclusion, hold and wait, no preemption, and circular wait do not all occur simultaneously, such as requiring processes to request all resources upfront or imposing a total ordering of resource types. Deadlock avoidance uses additional information about future resource needs to decide if a request can be granted. Detection and recovery methods are employed if deadlocks are allowed to occur.

deadlock in OS.pptx
deadlock in OS.pptxdeadlock in OS.pptx
deadlock in OS.pptx

The document summarizes key topics about deadlocks in operating systems including deadlock characterization, prevention, and avoidance. It defines deadlock as a set of blocked processes where each process is waiting for a resource held by another in the set. Four conditions must be met for deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. Deadlock prevention methods ensure systems never enter a deadlock state while avoidance uses a safe state algorithm and resource ordering to dynamically prevent unsafe states.

deadlockmicrosoftoperating system
Several Instances of a Resource Type Available :   A vector of length  m  indicates the number of available resources of each type. Allocation :   An  n  x  m  matrix defines the number of resources of each type currently allocated to each process. Request :   An  n  x  m  matrix indicates the current request  of each process.  If  Request  [ i j ] =  k , then process  P i  is requesting  k  more instances of resource type.  R j . Deadlocks-Galvin sonali C.
Detection Algorithm Let  Work  and  Finish  be vectors of length  m  and  n , respectively Initialize: (a)  Work  =  Available (b) For  i  = 1,2, …,  n , if  Allocation i     0, then  Finish [i] = false;otherwise,  Finish [i] =  true . 2. Find an index  i  such that both: (a) Finish [ i ] ==  false (b) Request i      Work If no such  i  exists, go to step 4.  Deadlocks-Galvin sonali C.
Work  =  Work  +  Allocation i Finish [ i ] =  true go to step 2. 4. If  Finish [ i ] == false, for some  i , 1     i      n , then the system is in deadlock state. Moreover, if  Finish [ i ] ==  false , then  P i  is deadlocked. Deadlocks-Galvin sonali C.
Example of Detection Algorithm Five processes  P 0  through  P 4 ;   three resource types  A (7 instances),  B  (2 instances), and  C  (6 instances). Snapshot at time  T 0 :   Allocation Request Available A B C  A B C  A B C P 0 0 1 0  0 0 0  0 0 0 P 1 2 0 0  2 0 2 P 2 3 0 3 0 0 0  P 3 2 1 1  1 0 0  P 4 0 0 2  0 0 2 Sequence < P 0 ,  P 2 ,  P 3 ,  P 1 ,  P 4 > will result in  Finish [ i ] = true for all  i .  Deadlocks-Galvin sonali C.

Recommended for you

7.Dead Locks
7.Dead Locks7.Dead Locks
7.Dead Locks

Senthilkanth,MCA.. The following ppt's full topic covers Operating System for BSc CS, BCA, MSc CS, MCA students.. 1.Introduction 2.OS Structures 3.Process 4.Threads 5.CPU Scheduling 6.Process Synchronization 7.Dead Locks 8.Memory Management 9.Virtual Memory 10.File system Interface 11.File system implementation 12.Mass Storage System 13.IO Systems 14.Protection 15.Security 16.Distributed System Structure 17.Distributed File System 18.Distributed Co Ordination 19.Real Time System 20.Multimedia Systems 21.Linux 22.Windows

dead locks
Ice
IceIce
Ice

This chapter discusses deadlocks in computer systems. It defines deadlock as a situation where a set of blocked processes are each holding resources and waiting for additional resources held by other processes in the set, resulting in a circular wait. The chapter presents methods for handling deadlocks including deadlock prevention, avoidance, detection, and recovery. It describes the basic conditions for deadlock and models like the resource allocation graph used to analyze deadlock states. Banker's algorithm is provided as an example of a deadlock avoidance strategy.

Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final

This document summarizes key concepts related to deadlocks in operating systems. It defines the four necessary conditions for deadlock to occur: mutual exclusion, hold and wait, no preemption, and circular wait. It describes methods for handling deadlocks, including deadlock prevention, avoidance, detection, and recovery. Deadlock prevention techniques aim to ensure that at least one of the necessary conditions does not hold, such as imposing an ordering on how resources can be requested. Deadlock avoidance uses additional information to determine if a request could lead to a deadlocked state. Detection and recovery methods allow deadlocks to occur but provide algorithms for identifying and resolving deadlocked processes.

P 2  requests an additional instance of type  C . Request A B C   P 0 0 0 0   P 1 2 0 1 P 2 0 0 1 P 3 1 0 0  P 4 0 0 2 State of system? Can reclaim resources held by process  P 0 , but insufficient resources to fulfill other processes; requests. Deadlock exists, consisting of processes  P 1 ,  P 2 ,  P 3 , and  P 4 . Deadlocks-Galvin sonali C.
Detection-Algorithm Usage When, and how often, to invoke depends on: How often a deadlock is likely to occur? How many processes will need to be rolled back? One for each disjoint cycle If detection algorithm is invoked arbitrarily, there may be many cycles in the resource graph and so we would not be able to tell which of the many deadlocked processes “caused” the deadlock Deadlocks-Galvin sonali C.
Recovery from Deadlock:  Process Termination Abort all deadlocked processes. Abort one process at a time until the deadlock cycle is eliminated. In which order should we choose to abort? Priority of the process. How long process has computed, and how much longer to completion. Resources the process has used. Resources process needs to complete. How many processes will need to be terminated.  Is process interactive or batch? Deadlocks-Galvin sonali C.
Recovery from Deadlock: Resource Preemption Selecting a victim – minimize cost. Rollback – return to some safe state, restart process for that state. Starvation –  same process may always be picked as victim, include number of rollback in cost factor. Deadlocks-Galvin sonali C.

Recommended for you

Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d

The document discusses deadlocks in computer systems and various approaches to handling them. It defines deadlock as when a set of processes are blocked waiting for resources held by each other in a cyclic manner. There are four conditions required for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Methods to handle deadlocks include ignoring the problem, preventing deadlocks through design restrictions, avoiding deadlocks by dynamically checking for safety, and detecting and recovering from deadlocks after the fact. The banker's algorithm is presented as an avoidance technique using a resource allocation graph and safety checks.

Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock

Deadlock occurs when multiple processes are blocked waiting for resources held by other processes in the set, resulting in no forward progress. There are four conditions required for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Deadlock can be handled through prevention, avoidance, detection, and recovery. Prevention ensures one of the four conditions is never satisfied. Avoidance allows resource allocation if it does not lead to an unsafe state. Detection identifies when deadlock occurs. Recovery regains resources by terminating processes or preempting resources.

osvdeadlockgtu
Deadlock Detection Algorithm
Deadlock Detection AlgorithmDeadlock Detection Algorithm
Deadlock Detection Algorithm

Deadlocks occur in operating systems when processes are blocked waiting for resources held by other blocked processes, forming a circular wait. There are four conditions for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Deadlocks can be modeled using a resource allocation graph (RAG) with processes and resources as nodes and request/assignment edges. A cycle in the RAG indicates a deadlock. Detection algorithms work by maintaining a wait-for graph (WFG) and periodically searching for cycles, while avoidance methods analyze resource requests to allow only safe sequences.

deadlockalgorithmoperatingsystem
Thank You All The Best Deadlocks-Galvin sonali C.

More Related Content

What's hot

Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
Shashank Yenurkar
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Shayek Parvez
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
cscarcas
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
Venkata Sreeram
 
Deadlock
DeadlockDeadlock
Deadlock
Mayuri Verma
 
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYdeadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
अनिकेत चौधरी
 
Deadlock
DeadlockDeadlock
Deadlock
Sajan Sahu
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
DHIVYADEVAKI
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
AUST
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
MsAnita2
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
usmankiyani1
 
5 process synchronization
5 process synchronization5 process synchronization
5 process synchronization
BaliThorat1
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
Rajan Shah
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
Suraj Kumar
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
Amin Omi
 
Bankers
BankersBankers
Deadlock Presentation
Deadlock PresentationDeadlock Presentation
Deadlock Presentation
salmancreation
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems
totallooser
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
InteX Research Lab
 

What's hot (20)

Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Deadlock
DeadlockDeadlock
Deadlock
 
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYdeadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
5 process synchronization
5 process synchronization5 process synchronization
5 process synchronization
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
Bankers
BankersBankers
Bankers
 
Deadlock Presentation
Deadlock PresentationDeadlock Presentation
Deadlock Presentation
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
 

Viewers also liked

Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
Midhun Sankar
 
Intro to Deadlocks
Intro to DeadlocksIntro to Deadlocks
Intro to Deadlocks
lionpeal
 
Deadlock
DeadlockDeadlock
Deadlock
Abhinaw Rai
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
Sweetestangel Kochar
 
Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution
Bipul Chandra Kar
 
Deadlock
DeadlockDeadlock
Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
Harshana Madusanka Jayamaha
 

Viewers also liked (7)

Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Intro to Deadlocks
Intro to DeadlocksIntro to Deadlocks
Intro to Deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution
 
Deadlock
DeadlockDeadlock
Deadlock
 
Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
 

Similar to Operating System Deadlock Galvin

Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
marangburu42
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
Nivedita Kasturi
 
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)
dsuyal1
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
marangburu42
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
marangburu42
 
deadlock in OS.pptx
deadlock in OS.pptxdeadlock in OS.pptx
deadlock in OS.pptx
Monirul Islam
 
7.Dead Locks
7.Dead Locks7.Dead Locks
7.Dead Locks
Senthil Kanth
 
Ice
IceIce
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
marangburu42
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
Gichelle Amon
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
madhuributani
 
Deadlock Detection Algorithm
Deadlock Detection AlgorithmDeadlock Detection Algorithm
Deadlock Detection Algorithm
Mohammad Qureshi
 
Deadlock (1).ppt
Deadlock (1).pptDeadlock (1).ppt
Deadlock (1).ppt
Nusaike Mufthie
 
Deadlock
DeadlockDeadlock
Deadlock
Rajapriya82
 
Deadlock
DeadlockDeadlock
Deadlock
Rajapriya82
 
protection and security in operating systems
protection and security in operating systemsprotection and security in operating systems
protection and security in operating systems
MadhaviB6
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systems
Rai University
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
Dwight Sabio
 
Operating System
Operating SystemOperating System
Operating System
Subhasis Dash
 
OS_Ch8
OS_Ch8OS_Ch8

Similar to Operating System Deadlock Galvin (20)

Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
 
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
deadlock in OS.pptx
deadlock in OS.pptxdeadlock in OS.pptx
deadlock in OS.pptx
 
7.Dead Locks
7.Dead Locks7.Dead Locks
7.Dead Locks
 
Ice
IceIce
Ice
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlock Detection Algorithm
Deadlock Detection AlgorithmDeadlock Detection Algorithm
Deadlock Detection Algorithm
 
Deadlock (1).ppt
Deadlock (1).pptDeadlock (1).ppt
Deadlock (1).ppt
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
protection and security in operating systems
protection and security in operating systemsprotection and security in operating systems
protection and security in operating systems
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systems
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Operating System
Operating SystemOperating System
Operating System
 
OS_Ch8
OS_Ch8OS_Ch8
OS_Ch8
 

More from Sonali Chauhan

Chapter 2 enterprise an overview - alexis leon
Chapter 2 enterprise  an overview - alexis leonChapter 2 enterprise  an overview - alexis leon
Chapter 2 enterprise an overview - alexis leon
Sonali Chauhan
 
Chapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERPChapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERP
Sonali Chauhan
 
Chapter 5 E R P Modules Alexis Leon
Chapter 5  E R P  Modules    Alexis  LeonChapter 5  E R P  Modules    Alexis  Leon
Chapter 5 E R P Modules Alexis Leon
Sonali Chauhan
 
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Chapter 7   E R P  Implementation  Lifecycle    Alexis  LeonChapter 7   E R P  Implementation  Lifecycle    Alexis  Leon
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Sonali Chauhan
 
Chapter 10 Future Directions In Erp A Lexis Leon
Chapter 10 Future Directions In Erp   A Lexis LeonChapter 10 Future Directions In Erp   A Lexis Leon
Chapter 10 Future Directions In Erp A Lexis Leon
Sonali Chauhan
 
Chapter 9 Vendors Consultants Users Alexis Leon
Chapter 9  Vendors  Consultants  Users    Alexis  LeonChapter 9  Vendors  Consultants  Users    Alexis  Leon
Chapter 9 Vendors Consultants Users Alexis Leon
Sonali Chauhan
 
Chapter 3 E R P And Related Tech Alexis Leon
Chapter 3  E R P And Related  Tech    Alexis  LeonChapter 3  E R P And Related  Tech    Alexis  Leon
Chapter 3 E R P And Related Tech Alexis Leon
Sonali Chauhan
 
Chapter 1 enterprise resource planning alexis leon
Chapter 1 enterprise resource planning   alexis leonChapter 1 enterprise resource planning   alexis leon
Chapter 1 enterprise resource planning alexis leon
Sonali Chauhan
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
Sonali Chauhan
 
Chapter 2 Enterprise An Overview Alexis Leon
Chapter 2 Enterprise  An Overview   Alexis LeonChapter 2 Enterprise  An Overview   Alexis Leon
Chapter 2 Enterprise An Overview Alexis Leon
Sonali Chauhan
 
Chapter 1 Enterprise Resource Planning Alexis Leon
Chapter 1 Enterprise Resource Planning   Alexis LeonChapter 1 Enterprise Resource Planning   Alexis Leon
Chapter 1 Enterprise Resource Planning Alexis Leon
Sonali Chauhan
 
Chapter 7 Erp Implementation Lifecycle Alexis Leon
Chapter 7  Erp Implementation Lifecycle   Alexis LeonChapter 7  Erp Implementation Lifecycle   Alexis Leon
Chapter 7 Erp Implementation Lifecycle Alexis Leon
Sonali Chauhan
 
Mobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen SchillerMobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen Schiller
Sonali Chauhan
 
Se
SeSe
3.Medium Access Control
3.Medium Access Control3.Medium Access Control
3.Medium Access Control
Sonali Chauhan
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
Sonali Chauhan
 
Testing
TestingTesting
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
Sonali Chauhan
 
Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10
Sonali Chauhan
 
Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5
Sonali Chauhan
 

More from Sonali Chauhan (20)

Chapter 2 enterprise an overview - alexis leon
Chapter 2 enterprise  an overview - alexis leonChapter 2 enterprise  an overview - alexis leon
Chapter 2 enterprise an overview - alexis leon
 
Chapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERPChapter 10 Future Directions In ERP
Chapter 10 Future Directions In ERP
 
Chapter 5 E R P Modules Alexis Leon
Chapter 5  E R P  Modules    Alexis  LeonChapter 5  E R P  Modules    Alexis  Leon
Chapter 5 E R P Modules Alexis Leon
 
Chapter 7 E R P Implementation Lifecycle Alexis Leon
Chapter 7   E R P  Implementation  Lifecycle    Alexis  LeonChapter 7   E R P  Implementation  Lifecycle    Alexis  Leon
Chapter 7 E R P Implementation Lifecycle Alexis Leon
 
Chapter 10 Future Directions In Erp A Lexis Leon
Chapter 10 Future Directions In Erp   A Lexis LeonChapter 10 Future Directions In Erp   A Lexis Leon
Chapter 10 Future Directions In Erp A Lexis Leon
 
Chapter 9 Vendors Consultants Users Alexis Leon
Chapter 9  Vendors  Consultants  Users    Alexis  LeonChapter 9  Vendors  Consultants  Users    Alexis  Leon
Chapter 9 Vendors Consultants Users Alexis Leon
 
Chapter 3 E R P And Related Tech Alexis Leon
Chapter 3  E R P And Related  Tech    Alexis  LeonChapter 3  E R P And Related  Tech    Alexis  Leon
Chapter 3 E R P And Related Tech Alexis Leon
 
Chapter 1 enterprise resource planning alexis leon
Chapter 1 enterprise resource planning   alexis leonChapter 1 enterprise resource planning   alexis leon
Chapter 1 enterprise resource planning alexis leon
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
 
Chapter 2 Enterprise An Overview Alexis Leon
Chapter 2 Enterprise  An Overview   Alexis LeonChapter 2 Enterprise  An Overview   Alexis Leon
Chapter 2 Enterprise An Overview Alexis Leon
 
Chapter 1 Enterprise Resource Planning Alexis Leon
Chapter 1 Enterprise Resource Planning   Alexis LeonChapter 1 Enterprise Resource Planning   Alexis Leon
Chapter 1 Enterprise Resource Planning Alexis Leon
 
Chapter 7 Erp Implementation Lifecycle Alexis Leon
Chapter 7  Erp Implementation Lifecycle   Alexis LeonChapter 7  Erp Implementation Lifecycle   Alexis Leon
Chapter 7 Erp Implementation Lifecycle Alexis Leon
 
Mobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen SchillerMobile Communication Broadcast System Jochen Schiller
Mobile Communication Broadcast System Jochen Schiller
 
Se
SeSe
Se
 
3.Medium Access Control
3.Medium Access Control3.Medium Access Control
3.Medium Access Control
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
Testing
TestingTesting
Testing
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10Erp Alex Leon Chapter 10
Erp Alex Leon Chapter 10
 
Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5Erp Alex Leon Chapter 5
Erp Alex Leon Chapter 5
 

Recently uploaded

Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
How Netflix Builds High Performance Applications at Global Scale
How Netflix Builds High Performance Applications at Global ScaleHow Netflix Builds High Performance Applications at Global Scale
How Netflix Builds High Performance Applications at Global Scale
ScyllaDB
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
kantakumariji156
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
Safe Software
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
Edge AI and Vision Alliance
 
5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
SATYENDRA100
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
The Digital Insurer
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
Linda Zhang
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
SeasiaInfotech2
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
FellyciaHikmahwarani
 

Recently uploaded (20)

Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
How Netflix Builds High Performance Applications at Global Scale
How Netflix Builds High Performance Applications at Global ScaleHow Netflix Builds High Performance Applications at Global Scale
How Netflix Builds High Performance Applications at Global Scale
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
@Call @Girls Guwahati 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any...
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
 
5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
 
What's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdfWhat's Next Web Development Trends to Watch.pdf
What's Next Web Development Trends to Watch.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
 

Operating System Deadlock Galvin

  • 1. Operating System: DEADLOCKS SONALI C. BSc (IT) UDIT Deadlocks-Galvin sonali C.
  • 2. What is Deadlock? 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 disk drive and each needs another one. Example 2 train approaches each other at crossing, both will come to full stop and neither shall start until other has gone. Deadlocks-Galvin sonali C.
  • 3. Deadlock Example Traffic only in one direction. Each section of a bridge can be viewed as a resource. If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback). Several cars may have to be backed up if a deadlock occurs. Starvation is possible Deadlocks-Galvin sonali C.
  • 4. What are we covering? 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 or avoiding deadlocks in a computer system. Deadlocks-Galvin sonali C.
  • 5. SYSTEM MODEL Each resource type R i has W i instances. Resource types R 1 , R 2 , . . ., R m CPU cycles, memory space, I/O devices System has 2 CPUs, then resource type CPU has 2 instance. Each process utilizes a resource as follows: request (system call) use release (system call) Deadlocks-Galvin sonali C.
  • 6. DEADLOCK CHARACTERIZATION Deadlock can arise if four conditions hold simultaneously. Mutual exclusion: only one process at a time can use a resource. Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. Deadlocks-Galvin sonali C.
  • 7. No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task. Circular wait: there exists a set { P 0 , P 1 , …, 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 0 is waiting for a resource that is held by P 0 . Deadlocks-Galvin sonali C. CONT…
  • 8. RESOURCE-ALLOCATION GRAPH Deadlocks can be described in term of directed graph- SYSTEM RESOURCE-ALLOCATION GRAPH . A set of vertices V and a set of edges E . V is partitioned into two types: P = { P 1 , P 2 , …, P n }, the set consisting of all the processes in the system. R = { R 1 , R 2 , …, R m }, the multi-set consisting of all resource types in the system. request edge – directed edge P 1  R j assignment edge – directed edge R j  P i Deadlocks-Galvin sonali C.
  • 9. RESOURCE-ALLOCATION GRAPH Process Resource Type with 4 instances P i requests instance of R j P i is holding an instance of R j Deadlocks-Galvin sonali C. CONT… P i P i R j R j
  • 10. EXAMPLE OF RESOURCE-ALLOCATION GRAPH Deadlocks-Galvin sonali C. CONT…
  • 11. RESOURCE-ALLOCATION GRAPH WITH A DEADLOCK P1 -> R1 -> P2 -> R3 -> P3 -> R2 -> P1 P2 -> R3 -> P3 -> R2 -> P1 Deadlocks-Galvin sonali C. CONT…
  • 12. GRAPH WITH A CYCLE BUT NO DEADLOCK P1 -> R1 -> P3 -> R2 -> P1 No deadlock P4 may release its instance of resource R2 Then it can be allocated to P3 Deadlocks-Galvin sonali C. CONT…
  • 13. If graph contains no cycles  no deadlock. If graph contains a cycle  if only one instance per resource type, then deadlock. if several instances per resource type, possibility of deadlock. RESOURCE-ALLOCATION GRAPH Deadlocks-Galvin sonali C. CONT…
  • 14. METHODS FOR HANDLING DEADLOCK We can deal with DL problem in 3-ways: Prevention/Avoidance Ensure that the system will never enter a deadlock state. Detection/Correction Allow system to enter a deadlock state and then recover. Ignorance Ignore problem and pretend that deadlocks never occur Used by most operating systems, including UNIX . Deadlocks-Galvin sonali C.
  • 15. METHODS FOR HANDLING DEADLOCK Prevention Set of methods for ensuring that at least one of the condition cannot hold. Avoidance OS be given information about the resources request used in advance Deadlocks-Galvin sonali C. CONT…
  • 16. DEADLOCK PREVENTION Restrain the ways request can be made. Mutual Exclusion – not required for sharable resources; must hold for non-sharable resources. A printer cannot simultaneously shared by several process Deadlocks-Galvin sonali C.
  • 17. DEADLOCK PREVENTION Hold and Wait – must guarantee that whenever a process requests a resource, it does not hold any other resources. Require process to request and be allocated all its resources before it begins execution Or…allow process to request resources only when the process has none. Cons: Lower resource utilization Starvation Deadlocks-Galvin sonali C. CONT…
  • 18. DEADLOCK PREVENTION No Preemption – If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are released. Preempted resources are added to the list of resources for which the process is waiting. Process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting. If process is requesting another resource, if it is available then it is given to requesting process If it is held by another process which is waiting for another resource, we release it n give it to requesting process. Deadlocks-Galvin sonali C. CONT…
  • 19. DEADLOCK PREVENTION Circular Wait – impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration. Deadlocks-Galvin sonali C. CONT…
  • 20. DEADLOCK AVOIDANCE Requires additional information about how resources are to be used. Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. Deadlocks-Galvin sonali C.
  • 21. SAFE STATE When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. Systems is in safe state if there exists a safe sequence of all process A sequence < P 1 , P 2 , …, P n > of ALL the processes is the system 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 . Deadlocks-Galvin sonali C.
  • 22. SAFE STATE 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. Deadlocks-Galvin sonali C. CONT…
  • 23. SAFE, UNSAFE DEADLOCK STATE If system is in safe state => No deadlock If system in not in safe state => possibility of deadlock OS cannot prevent processes from requesting resources in a sequence that leads to deadlock Avoidance => ensue that system will never enter an unsafe state, prevent getting into deadlock Deadlocks-Galvin sonali C. CONT…
  • 24. SAFE STATE - Example Suppose processes P0, P1, and P2 share 12 magnetic tape drives Currently 9 drives are held among the processes and 3 are available Question: Is this system currently in a safe state? Answer: Yes! Safe Sequence: <P1, P0, P2> Deadlocks-Galvin sonali C. CONT…
  • 25. System in UNSAFE STATE Suppose process P2 requests and is allocated 1 more tape drive. Question: Is the resulting state still safe? Answer: No! Because there does not exist a safe sequence anymore. Only P1 can be allocated its maximum needs. IF P0 and P2 request 5 more drives and 6 more drives, respectively, then the resulting state will be deadlocked. Deadlocks-Galvin sonali C. CONT… 3
  • 26. SAFE STATE - DEADLOCK AVOIDANCE Key Ideas: Initially the system is in a safe state Whenever a process requests an available resource, system will allocate resource immediately only if the resulting state is still safe! Otherwise, requesting process must wait. Deadlocks-Galvin sonali C. CONT…
  • 27. DEADLOCK AVOIDANCE ALGORITHM Single instance of a resource type . Use a resource-allocation graph Cycles are necessary are sufficient for deadlock Multiple instances of a resource type. Use the banker’s algorithm Cycles are necessary, but not sufficient for deadlock Deadlocks-Galvin sonali C.
  • 28. RESOURCE ALLOCATION GRAPH ALGORITHM Claim edge P i  R j indicates that process P j may request resource R j ; represented by a dashed line. Claim edge converts to request edge when a process requests a resource. Request edge converted to an assignment edge when the resource is allocated to the process. When a resource is released by a process, assignment edge reconverts to a claim edge. Resources must be claimed a priori in the system. Deadlocks-Galvin sonali C.
  • 29. RESOURCE ALLOCATION GRAPH ALGORITHM P2 requesting R1, but R1 is already allocated to P1. Both processes have a claim on resource R2 What happens if P2 now requests resource R2? Deadlocks-Galvin sonali C. CONT…
  • 30. UNSAFE STATE IN RESOURCE ALLOCATIONGRAPH ALGORITHM Cannot allocate resource R2 to process P2 Why? Because resulting state is unsafe P1 could request R2, thereby creating deadlock! Deadlocks-Galvin sonali C. CONT…
  • 31. RESOURCE ALLOCATION GRAPH ALGORITHM Use only when there is a single instance of each resource type Suppose that process P i requests a resource R j The request can be granted only if converting the request edge to an assignment edge does not result in the formation of a cycle in the resource allocation graph. Here we check for safety by using cycle-detection algorthim. Deadlocks-Galvin sonali C. CONT…
  • 32. BANKER’S ALGORITHM RAL is not applicable for multiple instance of resource Bankers’ algorithm - Multiple instances. Each process claims maximum resource needs a priori . When a process requests a resource it may have to wait. When a process gets all of its resources it must return them in a finite amount of time. Deadlocks-Galvin sonali C.
  • 33. BANKER’S ALGORITHM -Data structure Let, n = number of processes m = number of resources types Available : Vector of length m . If Available[ j ] = k , there are k instances of resource type R j available. Max : n x m matrix. If Max [ i,j ] = k , then process P i may request at most k instances of resource type R j . Allocation : n x m matrix. If Allocation[ i,j ] = k then P i is currently allocated k instances of R j. Need : n x m matrix. If Need [ i,j ] = k , then P i may need k more instances of R j to complete its task. Need [ i,j] = Max [ i,j ] – Allocation [ i,j ]. Deadlocks-Galvin sonali C. CONT…
  • 34. BANKER’S ALGORITHM - Safety Algorithm 1. Let Work and Finish be vectors of length m and n , respectively. Initialize: Work = Available Finish [ i ] = false for i = 0, 1, …, n- 1 . 2. Find and i such that both: (a) Finish [ i ] = false (b) Need i  Work If no such i exists, go to step 4. 3. Work = Work + Allocation i Finish [ i ] = true go to step 2. 4. If Finish [ i ] == true for all i , then the system is in a safe state. Deadlocks-Galvin sonali C. CONT…
  • 35. BANKER’S ALGORITHM - Resource Allocation Algorithm Request = request vector for process P i . If Request i [ j ] = k then process P i wants k instances of resource type R j . 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. 3. Pretend to allocate requested resources to P i by modifying the state as follows: Available = Available – Request; Allocation i = Allocation i + Request i ; Need i = Need i – Request i ; If safe  the resources are allocated to Pi. If unsafe  Pi must wait, and the old resource-allocation state is restored Deadlocks-Galvin sonali C. CONT…
  • 36. BANKER’S ALGORITHM - Example 5 processes P 0 through P 4 ; 3 resource types: A (10 instances), B (5instances), and C (7 instances). Snapshot at time T 0 : Allocation Max Available A B C A B C A B C P 0 0 1 0 7 5 3 3 3 2 P 1 2 0 0 3 2 2 P 2 3 0 2 9 0 2 P 3 2 1 1 2 2 2 P 4 0 0 2 4 3 3 Deadlocks-Galvin sonali C. CONT…
  • 37. BANKER’S ALGORITHM - Example cont… The content of the matrix Need is defined to be Max – Allocation . Need A B C P 0 7 4 3 P 1 1 2 2 P 2 6 0 0 P 3 0 1 1 P 4 4 3 1 The system is in a safe state since the sequence < P 1 , P 3 , P 4 , P 2 , P 0 > satisfies safety criteria. Deadlocks-Galvin sonali C. CONT…
  • 38. BANKER’S ALGORITHM - Example cont…(P1 Request (1,0,2)) Check that Request  Available (that is, (1,0,2)  (3,3,2)  true . Allocation Need Available A B C A B C A B C P 0 0 1 0 7 4 3 2 3 0 P 1 3 0 2 0 2 0 P 2 3 0 1 6 0 0 P 3 2 1 1 0 1 1 P 4 0 0 2 4 3 1 Executing safety algorithm shows that sequence < P 1 , P 3 , P 4 , P 0 , P 2 > satisfies safety requirement. Can request for (3,3,0) by P 4 be granted? –NO Can request for (0,2,0) by P 0 be granted? –NO ( Results Unsafe) Deadlocks-Galvin sonali C. CONT…
  • 39. DEADLOCK DETECTION Allow system to enter deadlock state Detection algorithm Recovery scheme Deadlocks-Galvin sonali C.
  • 40. Resource-Allocation Graph and Wait-for Graph For single instance P i -> P j (P i is waiting for P j to release a resource that P i needs) P i -> P j exist if and only if RAG contains 2 edges P i -> R q and R q -> P j for some resource R q Deadlocks-Galvin sonali C. Resource-Allocation Graph Corresponding wait-for graph
  • 41. Several Instances of a Resource Type Available : A vector of length m indicates the number of available resources of each type. Allocation : An n x m matrix defines the number of resources of each type currently allocated to each process. Request : An n x m matrix indicates the current request of each process. If Request [ i j ] = k , then process P i is requesting k more instances of resource type. R j . Deadlocks-Galvin sonali C.
  • 42. Detection Algorithm Let Work and Finish be vectors of length m and n , respectively Initialize: (a) Work = Available (b) For i = 1,2, …, n , if Allocation i  0, then Finish [i] = false;otherwise, Finish [i] = true . 2. Find an index i such that both: (a) Finish [ i ] == false (b) Request i  Work If no such i exists, go to step 4. Deadlocks-Galvin sonali C.
  • 43. Work = Work + Allocation i Finish [ i ] = true go to step 2. 4. If Finish [ i ] == false, for some i , 1  i  n , then the system is in deadlock state. Moreover, if Finish [ i ] == false , then P i is deadlocked. Deadlocks-Galvin sonali C.
  • 44. Example of Detection Algorithm Five processes P 0 through P 4 ; three resource types A (7 instances), B (2 instances), and C (6 instances). Snapshot at time T 0 : Allocation Request Available A B C A B C A B C P 0 0 1 0 0 0 0 0 0 0 P 1 2 0 0 2 0 2 P 2 3 0 3 0 0 0 P 3 2 1 1 1 0 0 P 4 0 0 2 0 0 2 Sequence < P 0 , P 2 , P 3 , P 1 , P 4 > will result in Finish [ i ] = true for all i . Deadlocks-Galvin sonali C.
  • 45. P 2 requests an additional instance of type C . Request A B C P 0 0 0 0 P 1 2 0 1 P 2 0 0 1 P 3 1 0 0 P 4 0 0 2 State of system? Can reclaim resources held by process P 0 , but insufficient resources to fulfill other processes; requests. Deadlock exists, consisting of processes P 1 , P 2 , P 3 , and P 4 . Deadlocks-Galvin sonali C.
  • 46. Detection-Algorithm Usage When, and how often, to invoke depends on: How often a deadlock is likely to occur? How many processes will need to be rolled back? One for each disjoint cycle If detection algorithm is invoked arbitrarily, there may be many cycles in the resource graph and so we would not be able to tell which of the many deadlocked processes “caused” the deadlock Deadlocks-Galvin sonali C.
  • 47. Recovery from Deadlock: Process Termination Abort all deadlocked processes. Abort one process at a time until the deadlock cycle is eliminated. In which order should we choose to abort? Priority of the process. How long process has computed, and how much longer to completion. Resources the process has used. Resources process needs to complete. How many processes will need to be terminated. Is process interactive or batch? Deadlocks-Galvin sonali C.
  • 48. Recovery from Deadlock: Resource Preemption Selecting a victim – minimize cost. Rollback – return to some safe state, restart process for that state. Starvation – same process may always be picked as victim, include number of rollback in cost factor. Deadlocks-Galvin sonali C.
  • 49. Thank You All The Best Deadlocks-Galvin sonali C.

Editor's Notes

  1. Enumeration:- The act of counting; reciting numbers in ascending order or A numbered list