Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
V.A.
CSED,TU
Disclaimer
This is NOT A COPYRIGHT
MATERIAL
www.os-book.com
www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm
www.personal.kent.edu/~rmuhamma/OpSystems/os.html
http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspx
http://www.computer.howsttuffworks.com/operating-system6.htm
http://williamstallings.com/OS/Animations.html
Etc
VA.
CSED,TU
VA.
CSED,TU
System Model
request
use
release
VA.
CSED,TU
Deadlock Characterization
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, , Pn1 is waiting for a resource that is held by
Pn, and P0 is waiting for a resource that is held by P0.
VA.
CSED,TU
RAG
R = {R1, R2, , Rm}, the set consisting of all resource types in the
system.
request edge directed edge P1 Rj
VA.
CSED,TU
Process
Pi requests instance of Rj
Pi is holding an instance of Rj
Pi
VA.
CSED,TU
Pi
Example - RAG
VA.
CSED,TU
VA.
CSED,TU
VA.
CSED,TU
Basic Facts
VA.
CSED,TU
Deadlock Prevention
Mutual Exclusion not required for sharable resources; must hold for
non sharable resources.
VA.
CSED,TU
No Preemption
Circular Wait impose a total ordering of all resource types, and require
that each process requests resources in an increasing order of
enumeration.
VA.
CSED,TU
VA.
CSED,TU
2.
3.
VA.
CSED,TU
Problem Statement
P0
P1
P2
P3
P4
Allocation
A B C
0 1 0
2 0 0
3 0 2
2 1 1
0 0 2
Max
A B C
7 5 3
3 2 2
9 0 2
2 2 2
4 3 3
Available
A B C
3 3 2
Request1 = (1,0,2)
After Calculating the Matrix Execute for below mentioned Requests
Request0 = (0,2,0)
Request4 = (3,3,0)
VA.
CSED,TU
Deadlock Detection
Detection algorithm
Recovery scheme
VA.
CSED,TU
VA.
CSED,TU
VA.
CSED,TU
VA.
CSED,TU
Deadlock Detection
1. Let Work and Finish be vectors of length m and n, respectively.
Initialize Work = Available. For i=0,1,2,n-1, if Allocationi Not equal
to ZERO, then Finish[i] = False; Otherwise,Finish[i] = True
2. Find an index i such that both
Finish[i] = = False
Requesti < 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] = = false for some i, then the system is in Deadlock State.
VA.
CSED,TU
Problem Statement
P0
P1
P2
P3
P4
Allocation
A B C
0 1 0
2 0 0
3 0 3
2 1 1
0 0 2
Request
A B C
0 0 0
2 0 2
0 0 0
1 0 0
0 0 2
Available
A B C
0 0 0
Request
A B C
0 0 0
2 0 2
0 0 1
1 0 0
0 0 2
VA.
CSED,TU
Rollback return to some safe state, restart process for that state.
VA.
CSED,TU
Thnx
VA.
CSED,TU