Академический Документы
Профессиональный Документы
Культура Документы
Website :: www.dhindsa.info
http://groups.google.com/group/os-2007
E-Mail :: sys.operating@gmail.com
1
O.S. by Er. K.S.Dhindsa © 2007
DEADLOCK DETECTION & RECOVERY
Detection with One Resource of Each Type (1)
IF graph contains one or more cycles
{any process part of cycle},a deadlock exists
IF no cycle exists,system is not deadlocked
Algorithm takes each node,as the root like of a tree
and does DFS on it
4
O.S. by Er. K.S.Dhindsa © 2007
Detection with Multiple Resource of Each Type (2)
5
O.S. by Er. K.S.Dhindsa © 2007
Deadlock Avoidance
Safe and Unsafe States (1)
7
O.S. by Er. K.S.Dhindsa © 2007
Basic Facts
• If a system is in safe state ⇒ no
deadlocks
8
O.S. by Er. K.S.Dhindsa © 2007
Safe, Unsafe , Deadlock State
9
O.S. by Er. K.S.Dhindsa © 2007
Deadlock Avoidance
I. The Dijkstra(1965) Banker's Algorithm for a Single Resource
13
O.S. by Er. K.S.Dhindsa © 2007
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.
• Leading to:
– low CPU utilization
– operating system thinks that it needs to increase
the degree of multiprogramming
– another process added to the system
17
O.S. by Er. K.S.Dhindsa © 2007
Thrashing (Cont.)
18
O.S. by Er. K.S.Dhindsa © 2007
Working-Set Model
• Works on the assumption of locality
∀ ∆ ≡ working-set window ≡ a fixed number of page
references
Example: 10,000 instruction
• WSSi (working set of Process Pi) =
total number of pages referenced in the most recent ∆
(varies in time)
– if ∆ too small will not encompass entire locality
– if ∆ too large will encompass several localities
– if ∆ = ∞ ⇒ will encompass entire program
• D = Σ WSSi ≡ total demand frames
20
O.S. by Er. K.S.Dhindsa © 2007
DEADLOCKS
Website :: www.dhindsa.info
http://groups.google.com/group/os-2007
21
O.S. by Er. K.S.Dhindsa © 2007