Deadlock Flashcards
What kind of resources can be taken away?
Preemptive resources
What kind of resources cannot be taken away?
Non-preemptive resources
A set of processes is ________ if each process in the set is waiting for an event that only another process in the set can cause.
deadlocked
when utilizing a resource you must ….
use a semaphore/mutex to get/release lock on resource.
What are the four conditions for deadlock?
- Mutual Exclusion
- Hold and Wait
- Non-preemptive resources
- Circular Wait
Deadlock is detected using a ________
Resource Allocation Graph (RAG)
What algorithm ignores the problems in deadlock?
Ostrich Algorithm
Once deadlock has been detected the system recovers it by …
- ___________ (takes away resources)
- ____________ (restores resource to earlier check point)
- ____________ (terminates a processes)
- Preemption
- Rollback
- Killing Processes
Describe safe and unsafe states.
Safe States
- not in deadlock
- there is some scheduling
order, so that all processes
can finish.
Unsafe States
- not necessarily deadlock
- does not guarantee deadlock
- but cannot guarantee
deadlock will be avoided.
Describe the Bankers Algorithm.
If granting a resource/request will lead to an unsafe state, do not grant the request,
if not, then grant the request
What are the 4 ways to deal with deadlock?
- Ostrich Algorithm
- Detect & recover
- Avoidance
- Prevention
Avoidance involves what?
Safe/Unsafe States
How do the 4 conditions prevent deadlock
- Mutual Exclusion
- spool everything - Hold and Wait
- request all resources initially - Non-preemptive Resources
- take resources away - Circular Wait
- order resources numerically
Describe two-phase locking
request all resources up front
-if resources abstained, do work
-if not, release what you did get & wait.
when avoiding circular wait if a process has a resource _____
only allow process to obtain a resource with a higher ID/number, otherwise give up the higher number resource and request “in order”