Professional Documents
Culture Documents
Systems SEECS-108A
❖ System Model
❖ No null messages
❖ Allow simulation to execute until deadlock occurs
❖ Provide a mechanism to detect deadlock
❖ Provide a mechanism to recover from deadlocks
Deadlock Detection &Recovery
C 1
4
Initially all the processes are in deadlock
C: Controller
Example
C 1
4
Example
C 1
4
Example
C 1
4
Example
C 1
4
Example
C=0, D=0
C=0, D=0
C 1
3 C=0, D=0
C=0, D=0 2
4
C=0, D=0
Example
C=0, D=1 C=0, D=0
C 1
3 C=0, D=0
C=0, D=0 2
4
C=0, D=0
Example
C=0, D=1 C=1, D=0
C 1
3 C=1, D=3
C=1, D=0 2
4
C=1, D=0
Example
C=0, D=1 C=1, D=0
C 1
3 C=1, D=3
C=1, D=1 2
4
C=1, D=0
Example
C=0, D=1 C=1, D=0
C 1
3 C=1, D=3
C=1, D=0 2
4
C=1, D=0
Example
C=0, D=1 C=1, D=0
C 1
3 C=1, D=3
C=1, D=0 2
4
C=1, D=0
Example
C=0, D=1 C=1, D=0
C 1
3 C=1, D=3
C=1, D=0 2
4
C=1, D=0
Example
C=0, D=1 C=0, D=0
C 1
3 C=1, D=2
C=1, D=0 2
4
C=1, D=0
Example
C=0, D=1 C=0, D=0
C 1
3 C=1, D=0
C=0, D=0 2
4
C=0, D=0
Example
C=0, D=0 C=0, D=0
C 1
3 C=0, D=0
C=0, D=0 2
4
C=0, D=0
Implementation: Signaling Protocol
❖ Signaling protocol
❖ When an engaged process receives a message
❖ Immediately return a signal to sender indicating
❖ message did not spawn a new node in the tree
❖ When a disengaged process receives a message:
❖ Receiving process becomes engaged
❖ Do not return a signal until it becomes disengaged
❖ An engaged process becomes disengaged (and sends a signal to its parent in the
tree) when
❖ It is idle, and It is a leaf node in the tree
❖ Process is a leaf it has received signals for all messages it has sent
Implementation
Drawback
❖ Only specify smallest time
events as being safe to process
Deadlock Detection &Recovery
❖ Deadlock recovery: identify safe events (events that can be processed w/o violating local causality)
❖ Which events are safe?
❖ Time stamp 7: smallest time stamped event in system
❖ Time stamp 8, 9: safe because of lookahead constraint
❖ Time stamp 10: OK if events with the same time stamp can
❖ be processed in any order
P2 (LA=3) P3,p4
P3(LA=5) P1
P4(LA=4) None
P1(LA=3) None
Time T0 T1 T2 T3 T4 T5 T6 T7 T8
P1
P2
P3
P4