deadlock detection and recovery by saad symbian

14
Presented by : Saad Wazir BS-CS REG# 1421-212019 Thursday , August 09, 2012 PRESTON University

Upload: saad-symbian

Post on 16-Dec-2014

1.720 views

Category:

Technology


1 download

DESCRIPTION

Deadlock detection and recovery

TRANSCRIPT

Page 1: Deadlock detection and recovery by saad symbian

Presented by :Saad WazirBS-CSREG# 1421-212019

Thursday , August 09, 2012PRESTONUniversity

Page 2: Deadlock detection and recovery by saad symbian

Deadlock Definition :

There exists a cycle of processes such that each process cannot proceed until the next process takes some specific action.

Result: all processes in the cycle are stuck!

P1P1

R1R1 P2P2

R2R2

Page 3: Deadlock detection and recovery by saad symbian

Deadlock solutions:

- Prevention :• Design system so that deadlock is impossible- Avoidance :• Steer around deadlock with smart scheduling- Detection & recovery :• Check for deadlock periodically• Recover by killing a deadlocked processes and releasing its resources- Do nothing :• Prevention, avoidance and detection/recovery are expensive• Manual intervention (kill processes, reboot) if needed

Page 4: Deadlock detection and recovery by saad symbian

Deadlock Prevention:

#1: No mutual exclusion• only one process at a time can use a resource.#2: no preemption• previously granted resources cannot forcibly taken away.#3: No hold and wait• When waiting for a resource, must not currently hold any resource#4: circular wait condition• Must be A circular chain of 2 or more processes• When Waiting For Resource Must Not Currently Hold Any Resource

Page 5: Deadlock detection and recovery by saad symbian
Page 6: Deadlock detection and recovery by saad symbian

Over View OF Deadlock Detection & Recovery :

Page 7: Deadlock detection and recovery by saad symbian

Deadlock Detection :

Check to see if a deadlock has occurred!

- Special case: Single resource per type• E.g., mutex locks (value is zero or one)• Check for cycles in the resource allocation graph- General case• E.g., semaphores, memory pages, ...

Page 8: Deadlock detection and recovery by saad symbian

Dependencies B/W processes:

Resource allocation graph Correspondingprocess dependency

graph

Page 9: Deadlock detection and recovery by saad symbian

Deadlock Recovery:

Recovery idea: get rid of the cycles inthe process dependency graph

Options:• Kill all deadlocked processes.• Kill one deadlocked process at a time andrelease its resources.• Steal one resource at a time.• Roll back all or one of the processes toSafe state.

Page 10: Deadlock detection and recovery by saad symbian

Deadlock Recovery:

Only have to kill one

Only have to kill one

Have to kill one more

Have to kill one more

Corresponding Processdependency graph

Corresponding Processdependency graph

Page 11: Deadlock detection and recovery by saad symbian

Deadlock Recovery:

How should we pick a process to kill?

We might consider...

• process priority• current computation time and time to completion• amount of resources used by the process• amount of resources needed by the process to complete• is process interactive or batch?

Page 12: Deadlock detection and recovery by saad symbian

Rollback instead of killing processes:

Selecting a victim• Minimize cost of rollback (e.g., size of process’s memory).

Rollback• Return to some safe state• Restart process for that state

Note: Large, long computations aresometimes checkpointed for other reasons (reliability) anyway

Page 13: Deadlock detection and recovery by saad symbian

Deadlock Summary:

Deadlock: cycle of processes/threads each waiting for the next• Nasty timing-dependent bugs!

Detection & Recovery• Typically very expensive to kill / checkpoint processes

Avoidance: steer around deadlock• Requires knowledge of everything an application will request• Expensive to perform on each scheduling event

Page 14: Deadlock detection and recovery by saad symbian

Philip GodfreyCS 241University of Illinois

Thursday , August 09, 2012PRESTONUniversity

Hope you enjoy & learn something

Fahad Wazir (Little Brother) , kamran Shah & Mian Abdul

Special Thanks to :