ch.8 deadlock Flashcards
1
Q
what is a deadlock?
A
occurs when two or more threads are waiting for an event that can only be caused by another process
1
Q
what is a preemptable resource?
A
can be taken away from a process without a problem
2
Q
what is a preemptable resource?
A
would cause a problem to fail if taken away
3
Q
starvation
A
an indefinite block of a thread
- all deadlocks cause starvation
- not all starvation are caused by deadlocks
4
Q
what are the four conditions for deadlock?
A
- mutual exclusion, each resource is held at most by one process
- hold and wait: a process holding resources can request more resources
- no preemption : the system cannot take resources from a process
- circular wait: there is a circular chain of 2 or more process where each is waiting for a resource held by the next member of the chain
5
Q
what is live lock?
A
occurs when threads can execute but cannot make progress
6
Q
how do we deal with deadlock?
A
- prevent mutual exclusion: Ensure that resources don’t need to be held to be used.
Ex: queue print jobs instead of holding a printer - prevent hold and wait : require processes to request all necessary processes
- Design all resources to be preemptable. This is kinda how
databases work: all transactions can be aborted. - prevent circular wait : Always acquire resources in same order. This is the “systems”
way