Chapter 7 Deadlocks

¡Supera tus tareas y exámenes ahora con Quizwiz!

The banker's algorithm is useful in a system with multiple instances of each resource type (T/F)

True

The circular-wait condition for a deadlock implies the hold-and-wait condition. (T/F)

True

The wait-for graph scheme is not applicable to a resource allocation system with multiple instances of each resource type. (T/F)

True

Describe two protocols to ensure that the hold-and-wait condition never occurs in a system.

1- Require process to request and be allocated all its resources before it begins execution 2- allow process to request resources only when the process has none allocated to it.

What does a claim edge signify in a resource-allocation graph?

A claim edge indicates that a process may request a resource at some time in the future. This edge resembles a request edge in direction, but is represented in the graph by a dashed line.

To handle deadlocks, operating systems most often _____. A) pretend that deadlocks never occur B) use protocols to prevent or avoid deadlocks C) detect and recover from deadlocks D) None of the above

A) pretend that deadlocks never occur

Assume there are three resources, R1, R2, and R3, that are each assigned unique integer values 15, 10, and 25, respectively. What is a resource ordering which prevents a circular wait? A) R1, R2, R3 B) R3, R2, R1 C) R3, R1, R2 D) R2, R1, R3

D) R2, R1, R3

One necessary condition for deadlock is ______, which states that a resource can be released only voluntarily by the process holding the resource. A) hold and wait B) mutual exclusion C) circular wait D) no preemption

D) no preemption

A system in an unsafe state will ultimately deadlock. (T/F)

False

Deadlock prevention and deadlock avoidance are essentially the same approaches for handling deadlock. (T/F)

False

If a resource-allocation graph has a cycle, the system must be in a deadlocked state (T/F)

False

Ordering resources and requiring the resources to be acquired in order prevents the circular wait from occurring and therefore prevents deadlock from occurring. (T/F)

False

Protocols to prevent hold-and-wait conditions typically also prevent starvation. (T/F)

False

Describe the four conditions that must hold simultaneously in a system if a deadlock is to occur.

Mutual exclusion - only 1 process at a time can use a resource hold & wait -a process holding at least 1 resource is waiting to acquire additional resources held by other processes no preemption - a resource can only be released voluntarily by the process holding it circular wait - there exists a set {P0, P1, ..., Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, ..., Pn-1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0.

Explain what has to happen for a set of processes to achieve a deadlocked state.

every process in the set must be waiting for an event that can be caused only by another process in the set. The processes cannot ever exit this state without manual intervention

What is one way to ensure that a circular-wait condition does not occur?

impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration Order the resource types and require that each process requests resources in an increasing order

What are the three general ways that a deadlock can be handled?

A deadlock can be prevented by using protocols to ensure that a deadlock will never occur. A system may allow a deadlock to occur, detect it, and recover from it. Lastly, an operating system may just ignore the problem and pretend that deadlocks can never occur.

Describe how a safe state ensures deadlock will be avoided.

A safe state ensures that there is a sequence of processes to finish their program execution. Deadlock is not possible while the system is in a safe state. If a system goes from safe to unsafe then a deadlock is possible. One way to assure that a system will always remain in a safe state can be done by only assigning a resource as long as it maintains the system in a safe state.

One necessary condition for deadlock is ______, which states that a process must be holding one resource and waiting to acquire additional resources. A) hold and wait B) mutual exclusion C) circular wait D) no preemption

A) hold and wait

The witness software product is a ____. A) lock-order verifier that uses mutual-exclusion locks to protect critical sections B) modeler to develop resource allocation graphs C) driver that can be used to prevent mutual exclusion for nonsharable resources D) implementation of the banker's algorithm available for most operating systems

A) lock-order verifier that uses mutual-exclusion locks to protect critical sections

A _____ could be preempted from a process. A) mutex lock B) CPU C) semaphore D) file lock

B) CPU

Which of the following data structures in the banker's algorithm is a vector of length m, where m is the number of resource types? A) Need B) Allocation C) Max D) Available

D) Available

A cycle in a resource-allocation graph is ____. A) a necessary and sufficient condition for deadlock in the case that each resource has more than one instance B) a necessary and sufficient condition for a deadlock in the case that each resource has exactly one instance C) a sufficient condition for a deadlock in the case that each resource has more than once instance D) is neither necessary nor sufficient for indicating deadlock in the case that each resource has exactly one instance

B) a necessary and sufficient condition for a deadlock in the case that each resource has exactly

One necessary condition for deadlock is ____, which states that at least one resource must be held in a nonsharable mode. A) hold and wait B) mutual exclusion C) circular wait D) no preemption

B) mutual exclusion

In a system resource-allocation graph, ____. A) a directed edge from a process to a resource is called an assignment edge B) a directed edge from a resource to a process is called a request edge C) a directed edge from a process to a resource is called a request edge D) None of the above

C) a directed edge from a process to a resource is called a request edge

One necessary condition for deadlock is ______, which states that there is a chain of waiting processes whereby P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, and Pn is waiting for a resource held by P0. A) hold and wait B) mutual exclusion C) circular wait D) no preemption

C) circular wait

A deadlocked state occurs whenever ____. A) a process is waiting for I/O to a device that does not exist B) the system has no available free resources C) every process in a set is waiting for an event that can only be caused by another process in the set D) a process is unable to release its request for a resource after use

C) every process in a set is waiting for an event that can only be caused by another process in the set

Which of the following statements is true? A) A safe state is a deadlocked state. B) A safe state may lead to a deadlocked state. C) An unsafe state is necessarily, and by definition, always a deadlocked state. D) An unsafe state may lead to a deadlocked state.

D) An unsafe state may lead to a deadlocked state.w3

What is the difference between deadlock prevention and deadlock avoidance?

prevention - a set of methods for ensuring that at least one of the necessary conditions for deadlock cannot hold. avoidance - requires that the operating system be given, in advance, additional information concerning which resources a process will request and use during its lifetime.


Conjuntos de estudio relacionados

Who Were the Enlightenment Philosophers?

View Set

MIST 2090 Part A Final Exam (All Quiz Study Guides)

View Set

Life Insurance Settlement Options

View Set

Discovering Nutrition Chapter 7: Vitamins

View Set

21: country rock and southern rock

View Set