What is a deadlock?
A state where a set of processes is blocked forever; each holds some resources and waits for others held by peers
List the three phases of resource use in the system model
request; use; release
What are resource types and instances?
Resource types are categories like CPU or printer; each type Ri has Wi instances that can be allocated
Give two examples of operating system resources
CPU cycles; memory space; I/O devices
Can deadlock involve same or different resource types?
Either; deadlock can involve same type or multiple different resource types
Define mutual exclusion in deadlock characterization
Only one process at a time can use a nonsharable resource
Define hold and wait
A process holds at least one resource while waiting to acquire additional resources held by others
Define no preemption
Resources cannot be forcibly taken; they are released only voluntarily after use
Define circular wait
When a group of processes are all waiting on each other in a loop, so nobody can move
When can deadlock arise according to the four conditions?
When mutual exclusion; hold and wait; no preemption; and circular wait all hold simultaneously
What is a resource allocation graph RAG?
A directed graph with process vertices and resource type vertices showing requests and assignments
What is a request edge in RAG notation?
A directed edge from process Pi to resource Rj meaning Pi is requesting an instance of Rj
What is an assignment edge in RAG notation?
A directed edge from resource Rj to process Pi meaning an instance of Rj is allocated to Pi
How is a resource with multiple instances shown in RAG?
A resource node Rj annotated with multiple dots or boxes representing instances
State the basic fact about cycles and deadlock with single instance per type
If the RAG contains a cycle and each type has one instance; the system is deadlocked
State the basic fact about cycles with several instances per type
If the RAG contains a cycle with several instances; deadlock is possible but not guaranteed
If the RAG has no cycles; what can we conclude?
No deadlock is present
Name the four broad methods for handling deadlocks
Prevention; avoidance; detection and recovery; ignoring deadlock
Which strategy is used by most mainstream OSes?
Ignoring deadlock; assume it never occurs; programmer handles rare cases
Why might ignoring deadlock be acceptable in practice?
Deadlocks are rare; prevention or avoidance can be costly; detection may not be worth overhead
Deadlock prevention aims to do what?
Ensure at least one of the necessary conditions never holds
Can we deny mutual exclusion to prevent deadlock?
Only sharable resources like read-only files avoid the need for mutual exclusion
Prevention for hold and wait: describe Method 1
Require each process to hog all the resources before execution
Downside of Method 1 for hold and wait prevention
Wastes resources; Longer waiting at the beginningt; may over-allocate