When a request is made,
check to see if after the request is satisfied, there is a (at least one!)
sequence of moves that can satisfy all the requests. that is, the new
state is safe. If so, satisfy the request, else make the request wait.
For example if given n processes and m resourcesMax[n * m] Allocated[n * m] Still_Needs[n * m]Available[m] Temp[m] Done[n]while () (Temp[j]=Available[j] for all j Find an i such that a) Done[i] = False b) Still_Needs[i,j] <= Temp[j] if so { Temp[j] += Allocated[i,j] for all j Done[i] = TRUE} } else if Done[i] = TRUE for all i then state is safe else state is unsafe}
|
(Taken from: http://carbon.cudenver.edu/~dkumar/CSC3453/Lec_figures/ch8_class_notes.pdf )
Is there a deadlock
currently?
One resource of each type
(1 printer, 1 plotter, 1 terminal etc.)
check if there is a
cycle in the resource graph. for each node N in the graph do DFS (depth
first search) of the graph with N as the root In the DFS if you come back
to a node already traversed, then there is a cycle. }
Multiple resources of each
type:
[ Basic idea, is that there is at least 1 execution which will un-deadlock the system
Further information could be searched on the following websites.
http://carbon.cudenver.edu/~dkumar/CSC3453/Lec_figures/ch8_class_notes.pdf
http://infocom.cqu.edu.au/Courses/aut2001/85349/Resources/Lectures/1999_Twelve/16/
http://occs.cs.oberlin.edu/faculty/jdonalds/341/lecture15.html
http://oucsace.cs.ohiou.edu/~osterman/class/cs442.archive/notes/ipc2.pdf
http://personal.cityu.edu.hk/~dcykcho/dco2230/chappp8/sld001.htm
http://www.cs.colostate.edu/~cs551/CourseNotes/Deadlock/DDAvoidance.html
http://www.doc.eng.cmu.ac.th/course/cpe442/LectureNotes/NotesOfYear2000/26
http://www.dynamicdrive.com/dynamicindex11/highlighttable.htm
Designed by: Harriet B. Nyakaana