Ch 7 Flashcards
1
Q
Necessary conditions for a deadlock
A
- Mutual exclusion. At least one resource must be held in a unshareable mode; that is, only one process at a time can use the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released.
- Hold and wait. A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.
- No preemption. Resources cannot be preempted; that is, a resource can be released only voluntarily by the process holding it, after that process has completed its task.
- Circular wait. A set {P0, P1, …, Pn} of waiting processes must exist such that P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, …, Pn−1 is waiting for a resource held by Pn, and Pn is waiting for a resource held by P0.
2
Q
Basic ideas of handling deadlocks
A
Prevent -ensure that at least one of the necessary conditions cannot hold.
Avoid - with additional knowledge, the operating system can decide for each request whether or not the process should wait.
Allow and recover
Ignore deadlock (most popular in modern operating systems, giving programmers the responsibility)
3
Q
resource state
A
state is defined by the number of available and allocated resources and the maximum demands of the processes.