Midterm 2 Flashcards
deadlock
A set of processes or threads are waiting and need something to make progress, but the thing they need is in another waiting process or thread
request (on a server)
When a process wants to use a resource
use (on a resource)
When a resource is in use by a process and usually cannot be used by any other processes
release (on a resource)
When a process is done using a resource. Allows another process to use the resource
livelock
A condition in which a thread continuously attempts an action that fails.
necessary conditions (for deadlock)
Mutual exclusion (some resources can only be used by one process at a time), hold and wait (processes can have some resources and ask for more), no preemption (OS gets a resource back only once a process is done using it), circular wait (its possible to build a cycle of processes P1..Pn such that each resource is held by the next process)
mutual exclusion (as a necessary condition for deadlock)
some resources can only be used by one process at a time
hold and wait (as a necessary condition for deadlock)
processes can have some resources and ask for more
no preemption (as a necessary condition for deadlock)
OS gets a resource back only once a process is done using it
circular wait (as a necessary condition for deadlock)
its possible to build a cycle of processes P1..Pn such that each resource is held by the next process
resource allocation graph
Shows which processes have which resources and which processes are requesting which resources
request edge
directed edge from a process to a resource in a resource allocation graph
assignment edge
directed edge from a resource instance to a process in a resource allocation graph
deadlock prevention
Building a system where deadlock can’t happen by preventing the deadlock conditions by happening
deadlock detection
The strategy of letting deadlocks happen and deal with them when they occur
deadlock avoidance
Deal with deadlock by staying on safe path by never letting a process do something that couldn’t cause deadlock in the future
claim edge
dashed arrow from process to resource in the resource allocation graph when the process might request the resource
safe state (in deadlock avoidance)
A state where processes could not create deadlock
unsafe state (in deadlock avoidance)
A state where processes could get into deadlock and the OS would not stop them
banker’s algorithm
Before a resource is granted, check if granted request would lead to unsafe state. If the request would lead to an unsafe state, the OS does not give the process the resource
wait-for graph
In deadlock detection, a variant of the resource-allocation graph with resource nodes removed; indicates a deadlock if the graph contains a cycle
recovery (from deadlock)
Usually have to terminate one or more processes
victim selection (in deadlock recovery)
Choose the best process to terminate
rollback (in deadlock recovery)
Terminating a process and restarting later