Quiz 1

advertisement
Quiz 7 Study Guide
Fill in the Blanks
1. A condition where a thread waits indefinitely is called ______________
2. An algorithm in which a threads states is max resource needs in advance and
waits if its needs would lead to deadlock is called the __________ algorithm.
3. Applying design rules to insure that deadlock never occurs is called _________.
4. Dynamically steering around deadlocks is called _______________.
5. Waiting until a deadlock occurs, hoping it will not happen, then recovering when
it does is called _______________.
Multiple Choice
6. Which of the items below are NOT a necessary condition for deadlock.
a. Mutual exclusion
b. Hold and wait
c. No preemption
d. Circular wait
e. Cycle of hold and wait relationships
f. None of the above.
:
7. Which of the following ways of dealing with deadlock applies best to the
allocation of main memory resources?
a. Banker’s algorithm
b. Preemption
c. Detection and recovery
d. Ordered resource allocation
e. Request all resources at one time
f. Process initialization denial
8. For which of the following kinds of resources would deadlock avoidance be most
likely to work well?
a. messages
b. main memory
c. semaphones
d. tape drives
True or False
9. Deadlock occurs then threads are waiting for resources with circular
dependencies.
10. Deadlock implies starvation.
11. Round-Robin CPU scheduling cannot prevent deadlock or starvation.
CHAPTER 7 from TEXT
Multiple Choice
1. A deadlocked state occurs whenever ____.
a.
b.
c.
d.
process is waiting for I/O to a device that does not exist
the system has no available free resources
every process in a set is waiting for an event that can only be caused by another process in
the set
a process is unable to release its request for a resource after use
2. 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
3. The witness software product is a(n) ____.
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
4. In a system resource-allocation graph, ____.
a.
b.
c.
d.
a directed edge from a process to a resource is called an assignment edge
a directed edge from a resource to a process is called a request edge
a directed edge from a process to resource is called a request edge
None of the above
5. 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
6. Which of the following is most often used by operating systems to handle deadlocks?
a.
b.
c.
d.
Pretend that deadlocks never occur
Use protocols to prevent or avoid deadlocks
Detect and recover from deadlocks
None of the above
7. 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.
8. Suppose that there are 10 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. Which of the following correctly
characterizes this state?
Process Maximum Needs Currently Owned
P0
10
4
P1
3
1
P2
6
4
a. It is safe.
b. It is not safe.
c. The state cannot be determined.
d. It is an impossible state.
9. 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
10. The safety algorithm provided in the text may require what order of operations to determine
whether a state is safe? Assume n is the number of processes and m is the number of resources.
a.
b.
c.
d.
Essay
11. Describe the four conditions that must hold simultaneously in a system if a deadlock is to occur.
12. What are the three general ways that a deadlock can be handled?
13. What is the difference between deadlock prevention and deadlock avoidance?
14. Describe two protocols to ensure that the hold-and-wait condition never occurs in a system.
15.
16.
17.
18.
19.
20.
What is one way to ensure that a circular-wait condition does not occur?
What does a claim edge signify in a resource-allocation graph?
Describe a wait-for graph and how it detects deadlock.
What factors influence the decision of when to invoke a detection algorithm?
Describe two methods for eliminating processes by aborting a process.
Name three issues that need to be addressed if a preemption is required to deal with deadlocks
TRUE/FALSE
21.
22.
23.
24.
25.
The circular-wait condition for a deadlock implies the hold-and-wait condition
If a resource-allocation graph has a cycle, the system must be in a deadlocked state.
In some circumstances, a system can be in a frozen state but not in a deadlocked state.
Protocols to prevent hold-and-wait conditions typically also prevent starvation.
The wait-for graph scheme is not applicable to a resource allocation system with multiple
instances of each resource type.
Download