






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A part of the lecture notes for comp 310: operating systems, specifically lecture 10. The topic of the lecture is deadlock, including what it is, how to prevent it, how to detect it, and how to recover from it. The document also covers the concept of a resource allocation graph and the banker's algorithm.
Typology: Study notes
1 / 11
This page cannot be seen from the preview
Don't miss anything!
How do we avoid it? How do we prevent it? How do we detect it? How do we recover from it? Do we really need to do anything at all???
Last time: Conditions for Deadlock
Resource Allocation Graph R R R P1 P2 P
Resource Allocation Graph R R R P1 P2 P Cycles may = deadlock… But not always! Why have a RAG?
Deadlock—What do we do about it?
Deadlock Prevention
Only use sharable resources. E.g., read-only files Not always possible
Deadlock Prevention
Give each resource a number. Must request in numerical order. Can prove that this means no circular wait no DL F(R1) <F(R2)<F(R3)…<F(R1) Can waste time/resources Deadlock Avoidance
An ordering <P 1 , P 2 , … Pn> such that each Pi can be satisfied with available resources plus those used by processes earlier in the sequence.
Safe state example HOLDS WILL NEED (additional) P0 4 4 P1 1 6 P2 1 1 2 free resources HOLDS WILL NEED (additional) P0 5 5 P1 2 2 P2 7 2 3 free resources
(how could it not lead to DL?) Banker’s Algorithm
Could fulfill everyone’s maximum in the right order
Safe state? Resource allocation
Safe state verification algorithm
An example Allocation Max Available P1 5 9 2 P2 0 7 P3 4 6 Should P3 be given 2 resource? Should P2 be given 2 resources?
Deadlock detection
Only difference is that now we actually found deadlock We do this to maximize resource use (unsafe not always DL) So we found deadlock, now what?