Deck 8: Deadlocks
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
Play
Full screen (f)
Deck 8: Deadlocks
1
Which of the following statement is true?
A) An unsafe state is a deadlocked state.
B) A deadlocked state is a safe state.
C) An unsafe state will lead to a deadlocked state.
D) An unsafe state may lead to a deadlocked state.
A) An unsafe state is a deadlocked state.
B) A deadlocked state is a safe state.
C) An unsafe state will lead to a deadlocked state.
D) An unsafe state may lead to a deadlocked state.
D
2
In the livelock example shown in Figure 8.2,
A) a livelock is guaranteed to occur.
B) a livelock may occur sometime.
C) a livelock may occur sometime only if there are more than one instances of thread_one and thread_two are running.
D) a livelock is guaranteed to occur as long as there are more than one instances of thread_one and thread_two are running.
A) a livelock is guaranteed to occur.
B) a livelock may occur sometime.
C) a livelock may occur sometime only if there are more than one instances of thread_one and thread_two are running.
D) a livelock is guaranteed to occur as long as there are more than one instances of thread_one and thread_two are running.
B
3
The Linux Lockdep tool is
A) used to verify locking order in the kernel.
B) a modeler to develop resource allocation graphs
C) a driver that can be used to prevent mutual exclusion for nonsharable resources
D) an implementation of the banker's algorithm available for most operating systems
A) used to verify locking order in the kernel.
B) a modeler to develop resource allocation graphs
C) a driver that can be used to prevent mutual exclusion for nonsharable resources
D) an implementation of the banker's algorithm available for most operating systems
A
4
Deadlocks can be prevented only if
A) all four necessary conditions cannot hold.
B) at least one of the four necessary conditions cannot hold.
C) mutual exclusion condition cannot hold.
D) circular wait condition cannot hold.
A) all four necessary conditions cannot hold.
B) at least one of the four necessary conditions cannot hold.
C) mutual exclusion condition cannot hold.
D) circular wait condition cannot hold.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
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
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
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
In the deadlock example shown in Figure 8.1,
A) a deadlock is guaranteed to occur.
B) a deadlock may occur sometime, but not necessarily every time.
C) a deadlock may occur sometime only if there are more than one instances of thread_one and thread_two are running.
D) a deadlock is guaranteed to occur as long as there are more than one instances of thread_one and thread_two are running.
A) a deadlock is guaranteed to occur.
B) a deadlock may occur sometime, but not necessarily every time.
C) a deadlock may occur sometime only if there are more than one instances of thread_one and thread_two are running.
D) a deadlock is guaranteed to occur as long as there are more than one instances of thread_one and thread_two are running.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
In a system resource-allocation graph, ____.
A) a directed edge from a resource to a process 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 an assignment edge
D) None of the above
A) a directed edge from a resource to a process 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 an assignment edge
D) None of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
Suppose that there are ten resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Process Maximum Needs Currently Owned
P0 10 4
P1 3 1
P2 5 4
At time 1, P1 requests a resource. Which of the following is correct?
A) The request will be granted, since the current state is safe.
B) The request will not be granted, since the current state is not safe.
C) The request will be granted, since the state after granting the request will be safe.
D) The request will not be granted, since the state after granting the request will be unsafe.
P0 10 4
P1 3 1
P2 5 4
At time 1, P1 requests a resource. Which of the following is correct?
A) The request will be granted, since the current state is safe.
B) The request will not be granted, since the current state is not safe.
C) The request will be granted, since the state after granting the request will be safe.
D) The request will not be granted, since the state after granting the request will be unsafe.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
A claim edge in a resource-allocation graph indicates that
A) a process has been allocated a resource.
B) a process may request a resource.
C) a process may release a resource that it has already been assigned.
D) a process has requested a resource.
A) a process has been allocated a resource.
B) a process may request a resource.
C) a process may release a resource that it has already been assigned.
D) a process has requested a resource.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
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
A) hold and wait
B) mutual exclusion
C) circular wait
D) no preemption
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
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
A) hold and wait
B) mutual exclusion
C) circular wait
D) no preemption
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
Which of the following is not a factor in choosing which process to terminate during recovery from a deadlock?
A) Who the parent of the process is.
B) How many more resources the process needs in order to complete.
C) How many processes will need to be terminated.
D) What the priority of the process is
A) Who the parent of the process is.
B) How many more resources the process needs in order to complete.
C) How many processes will need to be terminated.
D) What the priority of the process is
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
In a resource allocation graph, when a process releases a resource,
A) a request edge is inserted.
B) an assignment edge is inserted.
C) a request edge is removed.
D) an assignment edge is removed.
A) a request edge is inserted.
B) an assignment edge is inserted.
C) a request edge is removed.
D) an assignment edge is removed.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
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
A) hold and wait
B) mutual exclusion
C) circular wait
D) no preemption
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
Suppose that there are two resource types (R1 and R2) with five resources each available to four processes. At time 0, the following data is collected. The table indicates the process, the number of resources of each type currently allocated to the processes, and the current request of each resource type by each process. Process Allocation Request
R1 R2 R1 R2
P0 2 0 3 2
P1 1 1 1 0
P2 0 1 1 1
P3 1 1 3 2
Which of the following sentences is correct?
A) All four processes are currently deadlocked.
B) The system is not deadlocked.
C) Processes P0 and P3 are deadlocked.
D) Processes P0, P1 and P3 are deadlocked.
R1 R2 R1 R2
P0 2 0 3 2
P1 1 1 1 0
P2 0 1 1 1
P3 1 1 3 2
Which of the following sentences is correct?
A) All four processes are currently deadlocked.
B) The system is not deadlocked.
C) Processes P0 and P3 are deadlocked.
D) Processes P0, P1 and P3 are deadlocked.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
Deadlock prevention using preempting allocated resources cannot be used for
A) mutexes.
B) CPU registers.
C) database transactions.
D) memory.
A) mutexes.
B) CPU registers.
C) database transactions.
D) memory.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
In a system that uses deadlock detection algorithm,
A) a deadlock is detected as soon as it occurs.
B) a deadlock is detected just before it occurs.
C) a deadlock is detected sometime after it has occurred but not necessarily immediately.
D) a deadlock is detected sometime before it occurs, but not necessarily just before.
A) a deadlock is detected as soon as it occurs.
B) a deadlock is detected just before it occurs.
C) a deadlock is detected sometime after it has occurred but not necessarily immediately.
D) a deadlock is detected sometime before it occurs, but not necessarily just before.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
A _____ could be preempted from a process.
A) mutex lock
B) CPU registers
C) semaphore
D) file lock
A) mutex lock
B) CPU registers
C) semaphore
D) file lock
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
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
A) Need
B) Allocation
C) Max
D) Available
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
A system will never enter a deadlocked state if
A) the system chooses to ignore the problem altogether.
B) the system uses the detection and recovery technique.
C) the system uses the deadlock avoidance technique.
D) None of the above.
A) the system chooses to ignore the problem altogether.
B) the system uses the detection and recovery technique.
C) the system uses the deadlock avoidance technique.
D) None of the above.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Describe a wait-for graph and how it detects deadlock.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
Explain what has to happen for a set of processes to achieve a deadlocked state.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
The circular-wait condition for a deadlock implies the hold-and-wait condition.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
Ordering resources and requiring the resources to be acquired in order prevents the circular wait from occurring and therefore prevents deadlock from occurring.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
Describe two protocols to ensure that the hold-and-wait condition never occurs in a system.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
What is one way to ensure that a circular-wait condition does not occur?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
What does a claim edge signify in a resource-allocation graph?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
Protocols to prevent hold-and-wait conditions typically also prevent starvation.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
Recovery from a deadlock works best when a single process can be identified whose termination will break the circular wait.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
Describe how a safe state ensures deadlock will be avoided.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
Deadlock prevention and deadlock avoidance are essentially the same approaches for handling deadlock.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
A system in an unsafe state will ultimately deadlock.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
What are the three general ways that a deadlock can be handled?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
The banker's algorithm is useful in a system with multiple instances of each resource type.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
Describe the four conditions that must hold simultaneously in a system if a deadlock is to occur.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
What is the difference between deadlock prevention and deadlock avoidance?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
If the sum of all needs for a resource type exceeds the available number of instances of that resource type, the system state is unsafe.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
What factors influence the decision of when to invoke a detection algorithm?
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
Name three issues that need to be addressed if a preemption is required to deal with deadlocks.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
Describe two methods for eliminating deadlock by aborting a process.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck