Which OS's sweep deadlocks under the rug and pretend they don't exist as a method
for handling deadlocks?
Linux and Windows, often leave it up to kernel/app developers to handle it
TRUE/FALSE: Disallowing recovery after a deadlock is a method for handling
deadlocks.
FALSE: allowing the management of recovery is a vital method to handling deadlocks
What system allows deadlocks to occur and manages its recovery?
Databases
What are the two ways to ensure a Deadlock never occurs?
Deadlock Prevention and Deadlock Avoidance
How can the mutual exclusion condition be altered to prevent deadlocks?
TRICK QUESTION: mutual exclusion cannot be prevented and must hold, some
resources are fundamentally not shareable
How can the hold and wait condition be altered to prevent deadlocks?
guarantee a thread doesn’t hold other resources whenever it requests a new resource
Can starvation occur when implementing a non-hold and wait condition?
yes, low resource utilization will leave threads starved if they require multiple resources
How can the no preemption condition be modified to prevent deadlocks?
if a process holding some resources and requests another resource that can’t
immediately be allocated, the process releases all of its resources it currently holds.
process will be restarted its old resources AND the new ones it requested
Would the preemption condition for preventing deadlocks be more likely used for
resources like CPU registers or semaphores/mutex locks
CPU registers, preemption works best with resources can easily save and reload save
states. its not ideal for semaphores/mutex locks where deadlocks occur most commonly
How could the circular wait condition be altered to prevent deadlocks?
impose a total ordering of resource types, and require that each process requests
resources in an increasingly enumerated order
, Which deadlock prevention method is overall the most practical?
No circular wait method
TRUE/FALSE: the no circular wait method's hierarchy intrinsically prevents deadlocks.
BONUS: how do java developers order lock acquisition?
FALSE: it is up to developers to USE the hierarchy to prevent deadlocks
BONUS: System.identityHashCode(Object)
The most prominent model for deadlock avoidance requires what additional info about
each thread?
maximum number of resources of each type it needs
TRUE/FALSE: A safe state is when a system can allocate resources to each thread up
to its max in some order and still avoid a deadlock
TRUE
Which deadlock avoidance algorithm is used for single instances of a resource type,
and which for multiple?
SINGLE: resource allocation graph
MULTIPLE: Banker's algorithm
In a resource allocation graph algo, what does it mean when a resource must be
claimed "a priori"?
before a thread executes, its claims must be on the graph
In deadlock detection, what do we use for single instance of each resource type?
wait for graph, checking it periodically for a cycle in the graph
In deadlock detection, the multiple instance ... algorithm is of what runtime?
O(n^2 * m)
What are the two methods of deadlock recovery?
process/thread termination; resource preemption
TRUE/FALSE: when recovering from deadlocks via termination, aborting all deadlocked
processes is the only way to do so.