SlideShare a Scribd company logo
Silberschatz and Galvin19997.1
Operating System Concepts Silberschatz and Galvin19995.1Operating System Concepts Silberschatz and Galvin 19994.1
1 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
O P E R A T I N G S Y S T E M S
Chapter 7 : Deadlocks
• System Model
• Deadlock Characterization
• Methods for Handling Deadlocks
• Deadlock Prevention
• Deadlock Avoidance
• Deadlock Detection
• Recovery from Deadlock
• Combined Approach to Deadlock Handling
Operating System Concepts
Silberschatz and Galvin19997.2
Operating System Concepts Silberschatz and Galvin19995.2Operating System Concepts Silberschatz and Galvin 19994.2
2 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Chapter 7: Deadlocks
• System Model
• Deadlock Characterization
• Methods for Handling Deadlocks
• Deadlock Prevention
• Deadlock Avoidance
• Deadlock Detection
• Recovery from Deadlock
• Combined Approach to Deadlock Handling
Operating System Concepts
Silberschatz and Galvin19997.3
Operating System Concepts Silberschatz and Galvin19995.3Operating System Concepts Silberschatz and Galvin 19994.3
3 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
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 tape drives.
– P1 and P2 each hold one tape drive and each needs
another one.
• Example
– semaphores A and B, initialized to 1
P0 P1
wait (A); wait(B)
wait (B); wait(A)Operating System Concepts
Silberschatz and Galvin19997.4
Operating System Concepts Silberschatz and Galvin19995.4Operating System Concepts Silberschatz and Galvin 19994.4
4 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Bridge Crossing 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 upif a deadlock occurs.
• Starvation is possible.
Operating System Concepts
Silberschatz and Galvin19997.5
Operating System Concepts Silberschatz and Galvin19995.5Operating System Concepts Silberschatz and Galvin 19994.5
5 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
System Model
• Resource types R1, R2, . . ., Rm
CPU cycles, memory space, I/O devices
• Each resource type Ri has Wi instances.
• Each process utilizes a resource as follows:
– request
– use
– release
Operating System Concepts
Silberschatz and Galvin19997.6
Operating System Concepts Silberschatz and Galvin19995.6Operating System Concepts Silberschatz and Galvin 19994.6
6 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Characterization
• 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.
• 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 {P0, P1, …, P0} of waiting
processes such that P0 is waiting for a resource that is held by
P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is
waiting for a resource that is held by Pn, and P0 is waiting for a
resource that is held by P0.
Deadlock can arise if four conditions hold simultaneously.
Operating System Concepts
Silberschatz and Galvin19997.7
Operating System Concepts Silberschatz and Galvin19995.7Operating System Concepts Silberschatz and Galvin 19994.7
7 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph
• V is partitioned into two types:
– P = {P1, P2, …, Pn}, the set consisting of all the processes in
the system.
– R = {R1, R2, …, Rm}, the set consisting of all resource types
in the system.
• request edge – directed edge P1  Rj
• assignment edge – directed edge Rj  Pi
A set of vertices V and a set of edges E.
Operating System Concepts
Silberschatz and Galvin19997.8
Operating System Concepts Silberschatz and Galvin19995.8Operating System Concepts Silberschatz and Galvin 19994.8
8 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph (Cont.)
• Process
• Resource Type with 4 instances
• Pi requests instance of Rj
• Pi is holding an instance of Rj
Pi
Pi
Rj
Rj
Operating System Concepts
Silberschatz and Galvin19997.9
Operating System Concepts Silberschatz and Galvin19995.9Operating System Concepts Silberschatz and Galvin 19994.9
9 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of a Resource Allocation Graph
Operating System Concepts
Silberschatz and Galvin19997.10
Operating System Concepts Silberschatz and Galvin19995.10Operating System Concepts Silberschatz and Galvin 19994.10
10 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource Allocation Graph With A Deadlock
Operating System Concepts
Silberschatz and Galvin19997.11
Operating System Concepts Silberschatz and Galvin19995.11Operating System Concepts Silberschatz and Galvin 19994.11
11 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource Allocation Graph With A Cycle But No Deadlock
Operating System Concepts
Silberschatz and Galvin19997.12
Operating System Concepts Silberschatz and Galvin19995.12Operating System Concepts Silberschatz and Galvin 19994.12
12 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Basic Facts
• 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.
Operating System Concepts
Silberschatz and Galvin19997.13
Operating System Concepts Silberschatz and Galvin19995.13Operating System Concepts Silberschatz and Galvin 19994.13
13 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Methods for Handling Deadlocks
• Ensure that the system will never enter a deadlock state.
• Allow the system to enter a deadlock state and then recover.
• Ignore the problem and pretend that deadlocks never occur in the
system; used by most operating systems, including UNIX.
Operating System Concepts
Silberschatz and Galvin19997.14
Operating System Concepts Silberschatz and Galvin19995.14Operating System Concepts Silberschatz and Galvin 19994.14
14 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Prevention
• Mutual Exclusion – not required for sharable resources; must
hold for nonsharable resources.
• 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.
– Low resource utilization; starvation possible.
Restrain the ways request can be made.
Operating System Concepts
Silberschatz and Galvin19997.15
Operating System Concepts Silberschatz and Galvin19995.15Operating System Concepts Silberschatz and Galvin 19994.15
15 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Prevention (Cont.)
• 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.
• Circular Wait – impose a total ordering of all resource types, and
require that each process requests resources in an increasing
order of enumeration.
Operating System Concepts
Silberschatz and Galvin19997.16
Operating System Concepts Silberschatz and Galvin19995.16Operating System Concepts Silberschatz and Galvin 19994.16
16 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Avoidance
• 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.
Requires that the system has some additional a priori information
available.
Operating System Concepts
Silberschatz and Galvin19997.17
Operating System Concepts Silberschatz and Galvin19995.17Operating System Concepts Silberschatz and Galvin 19994.17
17 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safe State
• When a process requests an available resource, system must
decide if immediate allocation leaves the system in a safe state.
• System is in safe state if there exists a safe sequence of all
processes.
• Sequence <P1, P2, …, Pn> is safe if for each Pi, the resources
that Pi can still request can be satisfied by currently available
resources + resources held by all the Pj, with j<I.
– If Pi resource needs are not immediately available, then Pi
can wait until all Pj have finished.
– When Pj is finished, Pi can obtain needed resources,
execute, return allocated resources, and terminate.
– When Pi terminates, Pi+1 can obtain its needed resources,
and so on.
Operating System Concepts
Silberschatz and Galvin19997.18
Operating System Concepts Silberschatz and Galvin19995.18Operating System Concepts Silberschatz and Galvin 19994.18
18 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Basic Facts
• If a system is in safe state  no deadlocks.
• If a system is in unsafe state  possibility of deadlock.
• Avoidance  ensure that a system will never enter an unsafe
state.
Operating System Concepts
Silberschatz and Galvin19997.19
Operating System Concepts Silberschatz and Galvin19995.19Operating System Concepts Silberschatz and Galvin 19994.19
19 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safe, unsafe , deadlock state spaces
Operating System Concepts
Silberschatz and Galvin19997.20
Operating System Concepts Silberschatz and Galvin19995.20Operating System Concepts Silberschatz and Galvin 19994.20
20 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph Algorithm
• Claim edge Pi  Rj indicated that process Pj may request
resource Rj; represented by a dashed line.
• Claim edge converts to request edge when a process requests a
resource.
• When a resource is released by a process, assignment edge
reconverts to a claim edge.
• Resources must be claimed a priori in the system.
Operating System Concepts
Silberschatz and Galvin19997.21
Operating System Concepts Silberschatz and Galvin19995.21Operating System Concepts Silberschatz and Galvin 19994.21
21 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph For Deadlock Avoidance
Operating System Concepts
Silberschatz and Galvin19997.22
Operating System Concepts Silberschatz and Galvin19995.22Operating System Concepts Silberschatz and Galvin 19994.22
22 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Unsafe State In A Resource-Allocation Graph
Operating System Concepts
Silberschatz and Galvin19997.23
Operating System Concepts Silberschatz and Galvin19995.23Operating System Concepts Silberschatz and Galvin 19994.23
23 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Banker’s Algorithm
• Multiple instances.
• Each process must a priori claim maximum use.
• When a process requests a resource it may have to wait.
• When a process gets all its resources it must return them in a
finite amount of time.
Operating System Concepts
Silberschatz and Galvin19997.24
Operating System Concepts Silberschatz and Galvin19995.24Operating System Concepts Silberschatz and Galvin 19994.24
24 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Data Structures for the Banker’s Algorithm
• Available: Vector of length m. If available [j] = k, there are k
instances of resource type Rj available.
• Max: n x m matrix. If Max [i,j] = k, then process Pi may request at
most k instances of resource type Rj.
• Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently
allocated k instances of Rj.
• Need: n x m matrix. If Need[i,j] = k, then Pi may need k more
instances of Rj to complete its task.
Need [i,j] = Max[i,j] – Allocation [i,j].
Let n = number of processes, and m = number of resources types.
Operating System Concepts
Silberschatz and Galvin19997.25
Operating System Concepts Silberschatz and Galvin19995.25Operating System Concepts Silberschatz and Galvin 19994.25
25 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safety Algorithm
1. Let Work and Finish be vectors of length m and n, respectively.
Initialize:
Work := Available
Finish [i] = false for i - 1,3, …, n.
2. Find and i such that both:
(a) Finish [i] = false
(b) Needi  Work
If no such i exists, go to step 4.
3. Work := Work + Allocationi
Finish[i] := true
go to step 2.
4. If Finish [i] = true for all i, then the system is in a safe state.
Operating System Concepts
Silberschatz and Galvin19997.26
Operating System Concepts Silberschatz and Galvin19995.26Operating System Concepts Silberschatz and Galvin 19994.26
26 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Request Algorithm for Process Pi
Requesti = request vector for process Pi. If Requesti [j] = k then
process Pi wants k instances of resource type Rj.
1. If Requesti  Needi go to step 2. Otherwise, raise error
condition, since process has exceeded its maximum claim.
2. If Requesti  Available, go to step 3. Otherwise Pi must
wait, since resources are not available.
3. Pretend to allocate requested resources to Pi by modifying
the state as follows:
Available := Available = Requesti;
Allocationi := Allocationi + Requesti;
Needi := Needi – Requesti;;
• If safe  the resources are allocated to Pi.
• If unsafe  Pi must wait, and the old resource-allocation
state is restored
Operating System Concepts
Silberschatz and Galvin19997.27
Operating System Concepts Silberschatz and Galvin19995.27Operating System Concepts Silberschatz and Galvin 19994.27
27 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of Banker’s Algorithm
• 5 processes P0 through P4; 3 resource types A (10 instances),
B (5instances, and C (7 instances).
• Snapshot at time T0:
Allocation Max Available
A B C A B C A B C
P0 0 1 0 7 5 3 3 3 2
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
Operating System Concepts
Silberschatz and Galvin19997.28
Operating System Concepts Silberschatz and Galvin19995.28Operating System Concepts Silberschatz and Galvin 19994.28
28 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example (Cont.)
• The content of the matrix. Need is defined to be Max – Allocation.
Need
A B C
P0 7 4 3
P1 1 2 2
P2 6 0 0
P3 0 1 1
P4 4 3 1
• The system is in a safe state since the sequence < P1, P3, P4, P2, P0>
satisfies safety criteria.
Operating System Concepts
Silberschatz and Galvin19997.29
Operating System Concepts Silberschatz and Galvin19995.29Operating System Concepts Silberschatz and Galvin 19994.29
29 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
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
P0 0 1 0 7 4 3 2 3 0
P1 3 0 2 0 2 0
P2 3 0 1 6 0 0
P3 2 1 1 0 1 1
P4 0 0 2 4 3 1
• Executing safety algorithm shows that sequence <P1, P3, P4, P0, P2>
satisfies safety requirement.
• Can request for (3,3,0) by P4 be granted?
• Can request for (0,2,0) by P0 be granted?
Operating System Concepts
Silberschatz and Galvin19997.30
Operating System Concepts Silberschatz and Galvin19995.30Operating System Concepts Silberschatz and Galvin 19994.30
30 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Detection
• Allow system to enter deadlock state
• Detection algorithm
• Recovery scheme
Operating System Concepts
Silberschatz and Galvin19997.31
Operating System Concepts Silberschatz and Galvin19995.31Operating System Concepts Silberschatz and Galvin 19994.31
31 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Single Instance of Each Resource Type
• Maintain wait-for graph
– Nodes are processes.
– Pi  Pj if Pi is waiting for Pj.
• Periodically invoke an algorithm that searches for acycle in the
graph.
• An algorithm to detect a cycle in a graph requires an order of n2
operations, where n is the number of vertices in the graph.
Operating System Concepts
Silberschatz and Galvin19997.32
Operating System Concepts Silberschatz and Galvin19995.32Operating System Concepts Silberschatz and Galvin 19994.32
32 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph And Wait-for Graph
Resource-Allocation Graph Corresponding wait-for graph
Operating System Concepts
Silberschatz and Galvin19997.33
Operating System Concepts Silberschatz and Galvin19995.33Operating System Concepts Silberschatz and Galvin 19994.33
33 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 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 [ij] = k, then process Pi is requesting k more
instances of resource type. Rj.
Operating System Concepts
Silberschatz and Galvin19997.34
Operating System Concepts Silberschatz and Galvin19995.34Operating System Concepts Silberschatz and Galvin 19994.34
34 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Detection Algorithm
1. Let Work and Finish be vectors of length m and n, respectively
Initialize:
(a) Work :- Available
(b) For i = 1,2, …, n, if Allocationi  0, then
Finish[i] := false;otherwise, Finish[i] := true.
2. Find an index i such that both:
(a) Finish[i] = false
(b) Requesti  Work
If no such i exists, go to step 4.
Operating System Concepts
Silberschatz and Galvin19997.35
Operating System Concepts Silberschatz and Galvin19995.35Operating System Concepts Silberschatz and Galvin 19994.35
35 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Detection Algorithm (Cont.)
3. Work := Work + Allocationi
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 Pi is
deadlocked.
Algorithm requires an order of m x n2 operations to detect whether
the system is in deadlocked state.
Operating System Concepts
Silberschatz and Galvin19997.36
Operating System Concepts Silberschatz and Galvin19995.36Operating System Concepts Silberschatz and Galvin 19994.36
36 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of Detection Algorithm
• Five processes P0 through P4; three resource types
A (7 instances), B (2 instances), and C (6 instances).
• Snapshot at time T0:
Allocation Request Available
A B C A B C A B C
P0 0 1 0 0 0 0 0 0 0
P1 2 0 0 2 0 2
P2 3 0 3 0 0 0
P3 2 1 1 1 0 0
P4 0 0 2 0 0 2
• Sequence <P0, P2, P3, P1, P4> will result in Finish[i] = true for all i.
Operating System Concepts
Silberschatz and Galvin19997.37
Operating System Concepts Silberschatz and Galvin19995.37Operating System Concepts Silberschatz and Galvin 19994.37
37 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example (Cont.)
• P2 requests an additional instance of type C.
Request
A B C
P0 0 0 0
P1 2 0 1
P2 0 0 1
P3 1 0 0
P4 0 0 2
• State of system?
– Can reclaim resources held by process P0, but insufficient
resources to fulfill other processes; requests.
– Deadlock exists, consisting of processes P1, P2, P3, and P4.
Operating System Concepts
Silberschatz and Galvin19997.38
Operating System Concepts Silberschatz and Galvin19995.38Operating System Concepts Silberschatz and Galvin 19994.38
38 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
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.
Operating System Concepts
Silberschatz and Galvin19997.39
Operating System Concepts Silberschatz and Galvin19995.39Operating System Concepts Silberschatz and Galvin 19994.39
39 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
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?
Operating System Concepts
Silberschatz and Galvin19997.40
Operating System Concepts Silberschatz and Galvin19995.40Operating System Concepts Silberschatz and Galvin 19994.40
40 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Recovery from Deadlock: Resource Preemption
• Selecting a victim – minimize cost.
• Rollback – return to some safe state, restart process fro that
state.
• Starvation – same process may always be picked as victim,
include number of rollback in cost factor.
Operating System Concepts
Silberschatz and Galvin19997.41
Operating System Concepts Silberschatz and Galvin19995.41Operating System Concepts Silberschatz and Galvin 19994.41
41 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Combined Approach to Deadlock Handling
• Combine the three basic approaches
– prevention
– avoidance
– detection
allowing the use of the optimal approach for each of resources in
the system.
• Partition resources into hierarchically ordered classes.
• Use most appropriate technique for handling deadlocks within
each class.
Operating System Concepts

More Related Content

What's hot

Operating System : Ch11 file system implementation
Operating System : Ch11 file system implementationOperating System : Ch11 file system implementation
Operating System : Ch11 file system implementation
Syaiful Ahdan
 
Operating System : Ch12 io systems
Operating System : Ch12 io systemsOperating System : Ch12 io systems
Operating System : Ch12 io systems
Syaiful Ahdan
 
Ch13 io systems
Ch13 io systemsCh13 io systems
Ch13 io systems
Syaiful Ahdan
 
Operating System : Ch19 protection
Operating System :  Ch19 protectionOperating System :  Ch19 protection
Operating System : Ch19 protection
Syaiful Ahdan
 
LAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backporting
Linaro
 
Operating System : Ch4 b threads
Operating System : Ch4 b threadsOperating System : Ch4 b threads
Operating System : Ch4 b threads
Syaiful Ahdan
 
RAC+ASM: Stories to Share
RAC+ASM: Stories to ShareRAC+ASM: Stories to Share
RAC+ASM: Stories to Share
kutrovsky
 
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Anne Nicolas
 
ch15-pv1-time-management
ch15-pv1-time-managementch15-pv1-time-management
ch15-pv1-time-managementyushiang fu
 
BKK16-502 Suspend to Idle
BKK16-502 Suspend to IdleBKK16-502 Suspend to Idle
BKK16-502 Suspend to Idle
Linaro
 
LISA2010 visualizations
LISA2010 visualizationsLISA2010 visualizations
LISA2010 visualizations
Brendan Gregg
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machines
Anne Nicolas
 
101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot
Acácio Oliveira
 
101 1.3 runlevels, shutdown, and reboot v2
101 1.3 runlevels, shutdown, and reboot v2101 1.3 runlevels, shutdown, and reboot v2
101 1.3 runlevels, shutdown, and reboot v2
Acácio Oliveira
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
Brendan Gregg
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Brendan Gregg
 
Cache profiling on ARM Linux
Cache profiling on ARM LinuxCache profiling on ARM Linux
Cache profiling on ARM Linux
Prabindh Sundareson
 
LAS16-TR02: Upstreaming 101
LAS16-TR02: Upstreaming 101LAS16-TR02: Upstreaming 101
LAS16-TR02: Upstreaming 101
Linaro
 
Linux Kernel Live Patching
Linux Kernel Live PatchingLinux Kernel Live Patching
Linux Kernel Live Patching
GlobalLogic Ukraine
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
Brendan Gregg
 

What's hot (20)

Operating System : Ch11 file system implementation
Operating System : Ch11 file system implementationOperating System : Ch11 file system implementation
Operating System : Ch11 file system implementation
 
Operating System : Ch12 io systems
Operating System : Ch12 io systemsOperating System : Ch12 io systems
Operating System : Ch12 io systems
 
Ch13 io systems
Ch13 io systemsCh13 io systems
Ch13 io systems
 
Operating System : Ch19 protection
Operating System :  Ch19 protectionOperating System :  Ch19 protection
Operating System : Ch19 protection
 
LAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backportingLAS16-101: Efficient kernel backporting
LAS16-101: Efficient kernel backporting
 
Operating System : Ch4 b threads
Operating System : Ch4 b threadsOperating System : Ch4 b threads
Operating System : Ch4 b threads
 
RAC+ASM: Stories to Share
RAC+ASM: Stories to ShareRAC+ASM: Stories to Share
RAC+ASM: Stories to Share
 
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...
 
ch15-pv1-time-management
ch15-pv1-time-managementch15-pv1-time-management
ch15-pv1-time-management
 
BKK16-502 Suspend to Idle
BKK16-502 Suspend to IdleBKK16-502 Suspend to Idle
BKK16-502 Suspend to Idle
 
LISA2010 visualizations
LISA2010 visualizationsLISA2010 visualizations
LISA2010 visualizations
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machines
 
101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot
 
101 1.3 runlevels, shutdown, and reboot v2
101 1.3 runlevels, shutdown, and reboot v2101 1.3 runlevels, shutdown, and reboot v2
101 1.3 runlevels, shutdown, and reboot v2
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPFLinux 4.x Tracing: Performance Analysis with bcc/BPF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
 
Cache profiling on ARM Linux
Cache profiling on ARM LinuxCache profiling on ARM Linux
Cache profiling on ARM Linux
 
LAS16-TR02: Upstreaming 101
LAS16-TR02: Upstreaming 101LAS16-TR02: Upstreaming 101
LAS16-TR02: Upstreaming 101
 
Linux Kernel Live Patching
Linux Kernel Live PatchingLinux Kernel Live Patching
Linux Kernel Live Patching
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
 

Similar to Ch7 deadlocks

Operating System-Ch8 memory management
Operating System-Ch8 memory managementOperating System-Ch8 memory management
Operating System-Ch8 memory management
Syaiful Ahdan
 
Materi8mainmemory
Materi8mainmemoryMateri8mainmemory
Ch14 protection
Ch14 protectionCh14 protection
Ch14 protection
Syaiful Ahdan
 
Operating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationOperating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordination
Syaiful Ahdan
 
Operating System-Ch4.processes
Operating System-Ch4.processesOperating System-Ch4.processes
Operating System-Ch4.processes
Syaiful Ahdan
 
Operating System : Ch14.tertiary storage structure
Operating System : Ch14.tertiary storage structureOperating System : Ch14.tertiary storage structure
Operating System : Ch14.tertiary storage structure
Syaiful Ahdan
 
Ch12 file system implementation
Ch12 file system implementationCh12 file system implementation
Ch12 file system implementation
Syaiful Ahdan
 
Ch5 cpu scheduling
Ch5 cpu schedulingCh5 cpu scheduling
Ch5 cpu scheduling
Syaiful Ahdan
 
Ch11 file system interface
Ch11 file system interfaceCh11 file system interface
Ch11 file system interface
Syaiful Ahdan
 
Operating System-Ch5 cpu scheduling
Operating System-Ch5 cpu schedulingOperating System-Ch5 cpu scheduling
Operating System-Ch5 cpu scheduling
Syaiful Ahdan
 
Operating System : Ch9 virtual memory
Operating System : Ch9 virtual memoryOperating System : Ch9 virtual memory
Operating System : Ch9 virtual memory
Syaiful Ahdan
 
Ch15 security
Ch15 securityCh15 security
Ch15 security
Syaiful Ahdan
 
Operating System : Ch17 distributed file systems
Operating System : Ch17 distributed file systemsOperating System : Ch17 distributed file systems
Operating System : Ch17 distributed file systems
Syaiful Ahdan
 
Operating System : Ch20 security
Operating System : Ch20 securityOperating System : Ch20 security
Operating System : Ch20 security
Syaiful Ahdan
 
Ch5 process synchronization
Ch5 process synchronizationCh5 process synchronization
Ch5 process synchronization
Syaiful Ahdan
 
Operating System : Ch15 network structures
Operating System : Ch15 network structuresOperating System : Ch15 network structures
Operating System : Ch15 network structures
Syaiful Ahdan
 
Operating System-Ch6 process synchronization
Operating System-Ch6 process synchronizationOperating System-Ch6 process synchronization
Operating System-Ch6 process synchronization
Syaiful Ahdan
 
Operating System : Ch10 file system interface
Operating System : Ch10 file system interfaceOperating System : Ch10 file system interface
Operating System : Ch10 file system interface
Syaiful Ahdan
 
Ch4 threads
Ch4  threadsCh4  threads
Ch4 threads
Syaiful Ahdan
 
ch07.pdf
ch07.pdfch07.pdf
ch07.pdf
sharada3
 

Similar to Ch7 deadlocks (20)

Operating System-Ch8 memory management
Operating System-Ch8 memory managementOperating System-Ch8 memory management
Operating System-Ch8 memory management
 
Materi8mainmemory
Materi8mainmemoryMateri8mainmemory
Materi8mainmemory
 
Ch14 protection
Ch14 protectionCh14 protection
Ch14 protection
 
Operating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationOperating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordination
 
Operating System-Ch4.processes
Operating System-Ch4.processesOperating System-Ch4.processes
Operating System-Ch4.processes
 
Operating System : Ch14.tertiary storage structure
Operating System : Ch14.tertiary storage structureOperating System : Ch14.tertiary storage structure
Operating System : Ch14.tertiary storage structure
 
Ch12 file system implementation
Ch12 file system implementationCh12 file system implementation
Ch12 file system implementation
 
Ch5 cpu scheduling
Ch5 cpu schedulingCh5 cpu scheduling
Ch5 cpu scheduling
 
Ch11 file system interface
Ch11 file system interfaceCh11 file system interface
Ch11 file system interface
 
Operating System-Ch5 cpu scheduling
Operating System-Ch5 cpu schedulingOperating System-Ch5 cpu scheduling
Operating System-Ch5 cpu scheduling
 
Operating System : Ch9 virtual memory
Operating System : Ch9 virtual memoryOperating System : Ch9 virtual memory
Operating System : Ch9 virtual memory
 
Ch15 security
Ch15 securityCh15 security
Ch15 security
 
Operating System : Ch17 distributed file systems
Operating System : Ch17 distributed file systemsOperating System : Ch17 distributed file systems
Operating System : Ch17 distributed file systems
 
Operating System : Ch20 security
Operating System : Ch20 securityOperating System : Ch20 security
Operating System : Ch20 security
 
Ch5 process synchronization
Ch5 process synchronizationCh5 process synchronization
Ch5 process synchronization
 
Operating System : Ch15 network structures
Operating System : Ch15 network structuresOperating System : Ch15 network structures
Operating System : Ch15 network structures
 
Operating System-Ch6 process synchronization
Operating System-Ch6 process synchronizationOperating System-Ch6 process synchronization
Operating System-Ch6 process synchronization
 
Operating System : Ch10 file system interface
Operating System : Ch10 file system interfaceOperating System : Ch10 file system interface
Operating System : Ch10 file system interface
 
Ch4 threads
Ch4  threadsCh4  threads
Ch4 threads
 
ch07.pdf
ch07.pdfch07.pdf
ch07.pdf
 

More from Syaiful Ahdan

Sertifikat EC00202128391
 Sertifikat EC00202128391 Sertifikat EC00202128391
Sertifikat EC00202128391
Syaiful Ahdan
 
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
Syaiful Ahdan
 
Sertifikat ec00202059774
Sertifikat ec00202059774Sertifikat ec00202059774
Sertifikat ec00202059774
Syaiful Ahdan
 
Sertifikat ec00202059775
Sertifikat ec00202059775Sertifikat ec00202059775
Sertifikat ec00202059775
Syaiful Ahdan
 
Sertifikat EC00202045078
Sertifikat EC00202045078Sertifikat EC00202045078
Sertifikat EC00202045078
Syaiful Ahdan
 
Sertifikat EC00202044723
 Sertifikat EC00202044723 Sertifikat EC00202044723
Sertifikat EC00202044723
Syaiful Ahdan
 
Sertifikat EC00202023523
Sertifikat EC00202023523Sertifikat EC00202023523
Sertifikat EC00202023523
Syaiful Ahdan
 
Sertifikat EC00201826309
Sertifikat EC00201826309Sertifikat EC00201826309
Sertifikat EC00201826309
Syaiful Ahdan
 
Sertifikat EC00202023149
Sertifikat EC00202023149Sertifikat EC00202023149
Sertifikat EC00202023149
Syaiful Ahdan
 
Sertifikat EC00202022868
Sertifikat EC00202022868Sertifikat EC00202022868
Sertifikat EC00202022868
Syaiful Ahdan
 
Sertifikat EC00202021343
Sertifikat EC00202021343Sertifikat EC00202021343
Sertifikat EC00202021343
Syaiful Ahdan
 
Sertifikat EC00202022755
Sertifikat EC00202022755Sertifikat EC00202022755
Sertifikat EC00202022755
Syaiful Ahdan
 
Sertifikat EC00201987196
Sertifikat EC00201987196Sertifikat EC00201987196
Sertifikat EC00201987196
Syaiful Ahdan
 
Sertifikat EC00201856484
Sertifikat EC00201856484Sertifikat EC00201856484
Sertifikat EC00201856484
Syaiful Ahdan
 
Sertifikat EC00201856352
Sertifikat EC00201856352Sertifikat EC00201856352
Sertifikat EC00201856352
Syaiful Ahdan
 
Sertifikat EC00201856994
Sertifikat EC00201856994Sertifikat EC00201856994
Sertifikat EC00201856994
Syaiful Ahdan
 
Sertifikat EC00201856895
Sertifikat EC00201856895Sertifikat EC00201856895
Sertifikat EC00201856895
Syaiful Ahdan
 
Meeting 2 introdcution network administrator
Meeting 2   introdcution network administratorMeeting 2   introdcution network administrator
Meeting 2 introdcution network administrator
Syaiful Ahdan
 
Pertemuan 5
Pertemuan 5Pertemuan 5
Pertemuan 5
Syaiful Ahdan
 
Pertemuan 4
Pertemuan 4Pertemuan 4
Pertemuan 4
Syaiful Ahdan
 

More from Syaiful Ahdan (20)

Sertifikat EC00202128391
 Sertifikat EC00202128391 Sertifikat EC00202128391
Sertifikat EC00202128391
 
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
 
Sertifikat ec00202059774
Sertifikat ec00202059774Sertifikat ec00202059774
Sertifikat ec00202059774
 
Sertifikat ec00202059775
Sertifikat ec00202059775Sertifikat ec00202059775
Sertifikat ec00202059775
 
Sertifikat EC00202045078
Sertifikat EC00202045078Sertifikat EC00202045078
Sertifikat EC00202045078
 
Sertifikat EC00202044723
 Sertifikat EC00202044723 Sertifikat EC00202044723
Sertifikat EC00202044723
 
Sertifikat EC00202023523
Sertifikat EC00202023523Sertifikat EC00202023523
Sertifikat EC00202023523
 
Sertifikat EC00201826309
Sertifikat EC00201826309Sertifikat EC00201826309
Sertifikat EC00201826309
 
Sertifikat EC00202023149
Sertifikat EC00202023149Sertifikat EC00202023149
Sertifikat EC00202023149
 
Sertifikat EC00202022868
Sertifikat EC00202022868Sertifikat EC00202022868
Sertifikat EC00202022868
 
Sertifikat EC00202021343
Sertifikat EC00202021343Sertifikat EC00202021343
Sertifikat EC00202021343
 
Sertifikat EC00202022755
Sertifikat EC00202022755Sertifikat EC00202022755
Sertifikat EC00202022755
 
Sertifikat EC00201987196
Sertifikat EC00201987196Sertifikat EC00201987196
Sertifikat EC00201987196
 
Sertifikat EC00201856484
Sertifikat EC00201856484Sertifikat EC00201856484
Sertifikat EC00201856484
 
Sertifikat EC00201856352
Sertifikat EC00201856352Sertifikat EC00201856352
Sertifikat EC00201856352
 
Sertifikat EC00201856994
Sertifikat EC00201856994Sertifikat EC00201856994
Sertifikat EC00201856994
 
Sertifikat EC00201856895
Sertifikat EC00201856895Sertifikat EC00201856895
Sertifikat EC00201856895
 
Meeting 2 introdcution network administrator
Meeting 2   introdcution network administratorMeeting 2   introdcution network administrator
Meeting 2 introdcution network administrator
 
Pertemuan 5
Pertemuan 5Pertemuan 5
Pertemuan 5
 
Pertemuan 4
Pertemuan 4Pertemuan 4
Pertemuan 4
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

Ch7 deadlocks

  • 1. Silberschatz and Galvin19997.1 Operating System Concepts Silberschatz and Galvin19995.1Operating System Concepts Silberschatz and Galvin 19994.1 1 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 O P E R A T I N G S Y S T E M S Chapter 7 : Deadlocks • System Model • Deadlock Characterization • Methods for Handling Deadlocks • Deadlock Prevention • Deadlock Avoidance • Deadlock Detection • Recovery from Deadlock • Combined Approach to Deadlock Handling Operating System Concepts
  • 2. Silberschatz and Galvin19997.2 Operating System Concepts Silberschatz and Galvin19995.2Operating System Concepts Silberschatz and Galvin 19994.2 2 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Chapter 7: Deadlocks • System Model • Deadlock Characterization • Methods for Handling Deadlocks • Deadlock Prevention • Deadlock Avoidance • Deadlock Detection • Recovery from Deadlock • Combined Approach to Deadlock Handling Operating System Concepts
  • 3. Silberschatz and Galvin19997.3 Operating System Concepts Silberschatz and Galvin19995.3Operating System Concepts Silberschatz and Galvin 19994.3 3 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 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 tape drives. – P1 and P2 each hold one tape drive and each needs another one. • Example – semaphores A and B, initialized to 1 P0 P1 wait (A); wait(B) wait (B); wait(A)Operating System Concepts
  • 4. Silberschatz and Galvin19997.4 Operating System Concepts Silberschatz and Galvin19995.4Operating System Concepts Silberschatz and Galvin 19994.4 4 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Bridge Crossing 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 upif a deadlock occurs. • Starvation is possible. Operating System Concepts
  • 5. Silberschatz and Galvin19997.5 Operating System Concepts Silberschatz and Galvin19995.5Operating System Concepts Silberschatz and Galvin 19994.5 5 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 System Model • Resource types R1, R2, . . ., Rm CPU cycles, memory space, I/O devices • Each resource type Ri has Wi instances. • Each process utilizes a resource as follows: – request – use – release Operating System Concepts
  • 6. Silberschatz and Galvin19997.6 Operating System Concepts Silberschatz and Galvin19995.6Operating System Concepts Silberschatz and Galvin 19994.6 6 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Deadlock Characterization • 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. • 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 {P0, P1, …, P0} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and P0 is waiting for a resource that is held by P0. Deadlock can arise if four conditions hold simultaneously. Operating System Concepts
  • 7. Silberschatz and Galvin19997.7 Operating System Concepts Silberschatz and Galvin19995.7Operating System Concepts Silberschatz and Galvin 19994.7 7 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Allocation Graph • V is partitioned into two types: – P = {P1, P2, …, Pn}, the set consisting of all the processes in the system. – R = {R1, R2, …, Rm}, the set consisting of all resource types in the system. • request edge – directed edge P1  Rj • assignment edge – directed edge Rj  Pi A set of vertices V and a set of edges E. Operating System Concepts
  • 8. Silberschatz and Galvin19997.8 Operating System Concepts Silberschatz and Galvin19995.8Operating System Concepts Silberschatz and Galvin 19994.8 8 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Allocation Graph (Cont.) • Process • Resource Type with 4 instances • Pi requests instance of Rj • Pi is holding an instance of Rj Pi Pi Rj Rj Operating System Concepts
  • 9. Silberschatz and Galvin19997.9 Operating System Concepts Silberschatz and Galvin19995.9Operating System Concepts Silberschatz and Galvin 19994.9 9 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Example of a Resource Allocation Graph Operating System Concepts
  • 10. Silberschatz and Galvin19997.10 Operating System Concepts Silberschatz and Galvin19995.10Operating System Concepts Silberschatz and Galvin 19994.10 10 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource Allocation Graph With A Deadlock Operating System Concepts
  • 11. Silberschatz and Galvin19997.11 Operating System Concepts Silberschatz and Galvin19995.11Operating System Concepts Silberschatz and Galvin 19994.11 11 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource Allocation Graph With A Cycle But No Deadlock Operating System Concepts
  • 12. Silberschatz and Galvin19997.12 Operating System Concepts Silberschatz and Galvin19995.12Operating System Concepts Silberschatz and Galvin 19994.12 12 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Basic Facts • 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. Operating System Concepts
  • 13. Silberschatz and Galvin19997.13 Operating System Concepts Silberschatz and Galvin19995.13Operating System Concepts Silberschatz and Galvin 19994.13 13 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Methods for Handling Deadlocks • Ensure that the system will never enter a deadlock state. • Allow the system to enter a deadlock state and then recover. • Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX. Operating System Concepts
  • 14. Silberschatz and Galvin19997.14 Operating System Concepts Silberschatz and Galvin19995.14Operating System Concepts Silberschatz and Galvin 19994.14 14 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Deadlock Prevention • Mutual Exclusion – not required for sharable resources; must hold for nonsharable resources. • 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. – Low resource utilization; starvation possible. Restrain the ways request can be made. Operating System Concepts
  • 15. Silberschatz and Galvin19997.15 Operating System Concepts Silberschatz and Galvin19995.15Operating System Concepts Silberschatz and Galvin 19994.15 15 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Deadlock Prevention (Cont.) • 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. • Circular Wait – impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration. Operating System Concepts
  • 16. Silberschatz and Galvin19997.16 Operating System Concepts Silberschatz and Galvin19995.16Operating System Concepts Silberschatz and Galvin 19994.16 16 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Deadlock Avoidance • 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. Requires that the system has some additional a priori information available. Operating System Concepts
  • 17. Silberschatz and Galvin19997.17 Operating System Concepts Silberschatz and Galvin19995.17Operating System Concepts Silberschatz and Galvin 19994.17 17 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Safe State • When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. • System is in safe state if there exists a safe sequence of all processes. • Sequence <P1, P2, …, Pn> is safe if for each Pi, the resources that Pi can still request can be satisfied by currently available resources + resources held by all the Pj, with j<I. – If Pi resource needs are not immediately available, then Pi can wait until all Pj have finished. – When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and terminate. – When Pi terminates, Pi+1 can obtain its needed resources, and so on. Operating System Concepts
  • 18. Silberschatz and Galvin19997.18 Operating System Concepts Silberschatz and Galvin19995.18Operating System Concepts Silberschatz and Galvin 19994.18 18 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Basic Facts • If a system is in safe state  no deadlocks. • If a system is in unsafe state  possibility of deadlock. • Avoidance  ensure that a system will never enter an unsafe state. Operating System Concepts
  • 19. Silberschatz and Galvin19997.19 Operating System Concepts Silberschatz and Galvin19995.19Operating System Concepts Silberschatz and Galvin 19994.19 19 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Safe, unsafe , deadlock state spaces Operating System Concepts
  • 20. Silberschatz and Galvin19997.20 Operating System Concepts Silberschatz and Galvin19995.20Operating System Concepts Silberschatz and Galvin 19994.20 20 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Allocation Graph Algorithm • Claim edge Pi  Rj indicated that process Pj may request resource Rj; represented by a dashed line. • Claim edge converts to request edge when a process requests a resource. • When a resource is released by a process, assignment edge reconverts to a claim edge. • Resources must be claimed a priori in the system. Operating System Concepts
  • 21. Silberschatz and Galvin19997.21 Operating System Concepts Silberschatz and Galvin19995.21Operating System Concepts Silberschatz and Galvin 19994.21 21 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Allocation Graph For Deadlock Avoidance Operating System Concepts
  • 22. Silberschatz and Galvin19997.22 Operating System Concepts Silberschatz and Galvin19995.22Operating System Concepts Silberschatz and Galvin 19994.22 22 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Unsafe State In A Resource-Allocation Graph Operating System Concepts
  • 23. Silberschatz and Galvin19997.23 Operating System Concepts Silberschatz and Galvin19995.23Operating System Concepts Silberschatz and Galvin 19994.23 23 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Banker’s Algorithm • Multiple instances. • Each process must a priori claim maximum use. • When a process requests a resource it may have to wait. • When a process gets all its resources it must return them in a finite amount of time. Operating System Concepts
  • 24. Silberschatz and Galvin19997.24 Operating System Concepts Silberschatz and Galvin19995.24Operating System Concepts Silberschatz and Galvin 19994.24 24 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Data Structures for the Banker’s Algorithm • Available: Vector of length m. If available [j] = k, there are k instances of resource type Rj available. • Max: n x m matrix. If Max [i,j] = k, then process Pi may request at most k instances of resource type Rj. • Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently allocated k instances of Rj. • Need: n x m matrix. If Need[i,j] = k, then Pi may need k more instances of Rj to complete its task. Need [i,j] = Max[i,j] – Allocation [i,j]. Let n = number of processes, and m = number of resources types. Operating System Concepts
  • 25. Silberschatz and Galvin19997.25 Operating System Concepts Silberschatz and Galvin19995.25Operating System Concepts Silberschatz and Galvin 19994.25 25 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Safety Algorithm 1. Let Work and Finish be vectors of length m and n, respectively. Initialize: Work := Available Finish [i] = false for i - 1,3, …, n. 2. Find and i such that both: (a) Finish [i] = false (b) Needi  Work If no such i exists, go to step 4. 3. Work := Work + Allocationi Finish[i] := true go to step 2. 4. If Finish [i] = true for all i, then the system is in a safe state. Operating System Concepts
  • 26. Silberschatz and Galvin19997.26 Operating System Concepts Silberschatz and Galvin19995.26Operating System Concepts Silberschatz and Galvin 19994.26 26 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Request Algorithm for Process Pi Requesti = request vector for process Pi. If Requesti [j] = k then process Pi wants k instances of resource type Rj. 1. If Requesti  Needi go to step 2. Otherwise, raise error condition, since process has exceeded its maximum claim. 2. If Requesti  Available, go to step 3. Otherwise Pi must wait, since resources are not available. 3. Pretend to allocate requested resources to Pi by modifying the state as follows: Available := Available = Requesti; Allocationi := Allocationi + Requesti; Needi := Needi – Requesti;; • If safe  the resources are allocated to Pi. • If unsafe  Pi must wait, and the old resource-allocation state is restored Operating System Concepts
  • 27. Silberschatz and Galvin19997.27 Operating System Concepts Silberschatz and Galvin19995.27Operating System Concepts Silberschatz and Galvin 19994.27 27 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Example of Banker’s Algorithm • 5 processes P0 through P4; 3 resource types A (10 instances), B (5instances, and C (7 instances). • Snapshot at time T0: Allocation Max Available A B C A B C A B C P0 0 1 0 7 5 3 3 3 2 P1 2 0 0 3 2 2 P2 3 0 2 9 0 2 P3 2 1 1 2 2 2 P4 0 0 2 4 3 3 Operating System Concepts
  • 28. Silberschatz and Galvin19997.28 Operating System Concepts Silberschatz and Galvin19995.28Operating System Concepts Silberschatz and Galvin 19994.28 28 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Example (Cont.) • The content of the matrix. Need is defined to be Max – Allocation. Need A B C P0 7 4 3 P1 1 2 2 P2 6 0 0 P3 0 1 1 P4 4 3 1 • The system is in a safe state since the sequence < P1, P3, P4, P2, P0> satisfies safety criteria. Operating System Concepts
  • 29. Silberschatz and Galvin19997.29 Operating System Concepts Silberschatz and Galvin19995.29Operating System Concepts Silberschatz and Galvin 19994.29 29 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 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 P0 0 1 0 7 4 3 2 3 0 P1 3 0 2 0 2 0 P2 3 0 1 6 0 0 P3 2 1 1 0 1 1 P4 0 0 2 4 3 1 • Executing safety algorithm shows that sequence <P1, P3, P4, P0, P2> satisfies safety requirement. • Can request for (3,3,0) by P4 be granted? • Can request for (0,2,0) by P0 be granted? Operating System Concepts
  • 30. Silberschatz and Galvin19997.30 Operating System Concepts Silberschatz and Galvin19995.30Operating System Concepts Silberschatz and Galvin 19994.30 30 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Deadlock Detection • Allow system to enter deadlock state • Detection algorithm • Recovery scheme Operating System Concepts
  • 31. Silberschatz and Galvin19997.31 Operating System Concepts Silberschatz and Galvin19995.31Operating System Concepts Silberschatz and Galvin 19994.31 31 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Single Instance of Each Resource Type • Maintain wait-for graph – Nodes are processes. – Pi  Pj if Pi is waiting for Pj. • Periodically invoke an algorithm that searches for acycle in the graph. • An algorithm to detect a cycle in a graph requires an order of n2 operations, where n is the number of vertices in the graph. Operating System Concepts
  • 32. Silberschatz and Galvin19997.32 Operating System Concepts Silberschatz and Galvin19995.32Operating System Concepts Silberschatz and Galvin 19994.32 32 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Resource-Allocation Graph And Wait-for Graph Resource-Allocation Graph Corresponding wait-for graph Operating System Concepts
  • 33. Silberschatz and Galvin19997.33 Operating System Concepts Silberschatz and Galvin19995.33Operating System Concepts Silberschatz and Galvin 19994.33 33 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 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 [ij] = k, then process Pi is requesting k more instances of resource type. Rj. Operating System Concepts
  • 34. Silberschatz and Galvin19997.34 Operating System Concepts Silberschatz and Galvin19995.34Operating System Concepts Silberschatz and Galvin 19994.34 34 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Detection Algorithm 1. Let Work and Finish be vectors of length m and n, respectively Initialize: (a) Work :- Available (b) For i = 1,2, …, n, if Allocationi  0, then Finish[i] := false;otherwise, Finish[i] := true. 2. Find an index i such that both: (a) Finish[i] = false (b) Requesti  Work If no such i exists, go to step 4. Operating System Concepts
  • 35. Silberschatz and Galvin19997.35 Operating System Concepts Silberschatz and Galvin19995.35Operating System Concepts Silberschatz and Galvin 19994.35 35 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Detection Algorithm (Cont.) 3. Work := Work + Allocationi 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 Pi is deadlocked. Algorithm requires an order of m x n2 operations to detect whether the system is in deadlocked state. Operating System Concepts
  • 36. Silberschatz and Galvin19997.36 Operating System Concepts Silberschatz and Galvin19995.36Operating System Concepts Silberschatz and Galvin 19994.36 36 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Example of Detection Algorithm • Five processes P0 through P4; three resource types A (7 instances), B (2 instances), and C (6 instances). • Snapshot at time T0: Allocation Request Available A B C A B C A B C P0 0 1 0 0 0 0 0 0 0 P1 2 0 0 2 0 2 P2 3 0 3 0 0 0 P3 2 1 1 1 0 0 P4 0 0 2 0 0 2 • Sequence <P0, P2, P3, P1, P4> will result in Finish[i] = true for all i. Operating System Concepts
  • 37. Silberschatz and Galvin19997.37 Operating System Concepts Silberschatz and Galvin19995.37Operating System Concepts Silberschatz and Galvin 19994.37 37 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Example (Cont.) • P2 requests an additional instance of type C. Request A B C P0 0 0 0 P1 2 0 1 P2 0 0 1 P3 1 0 0 P4 0 0 2 • State of system? – Can reclaim resources held by process P0, but insufficient resources to fulfill other processes; requests. – Deadlock exists, consisting of processes P1, P2, P3, and P4. Operating System Concepts
  • 38. Silberschatz and Galvin19997.38 Operating System Concepts Silberschatz and Galvin19995.38Operating System Concepts Silberschatz and Galvin 19994.38 38 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 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. Operating System Concepts
  • 39. Silberschatz and Galvin19997.39 Operating System Concepts Silberschatz and Galvin19995.39Operating System Concepts Silberschatz and Galvin 19994.39 39 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 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? Operating System Concepts
  • 40. Silberschatz and Galvin19997.40 Operating System Concepts Silberschatz and Galvin19995.40Operating System Concepts Silberschatz and Galvin 19994.40 40 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Recovery from Deadlock: Resource Preemption • Selecting a victim – minimize cost. • Rollback – return to some safe state, restart process fro that state. • Starvation – same process may always be picked as victim, include number of rollback in cost factor. Operating System Concepts
  • 41. Silberschatz and Galvin19997.41 Operating System Concepts Silberschatz and Galvin19995.41Operating System Concepts Silberschatz and Galvin 19994.41 41 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41 Combined Approach to Deadlock Handling • Combine the three basic approaches – prevention – avoidance – detection allowing the use of the optimal approach for each of resources in the system. • Partition resources into hierarchically ordered classes. • Use most appropriate technique for handling deadlocks within each class. Operating System Concepts