Operating System Deadlock Solved MCQs
In this section of Operating System CPU Scheduling MCQs.it contain Operating System Process Management – Deadlocks MCQs (Multiple Choice Questions Answers).All the MCQs (Multiple Choice Question Answers) requires in detail reading of Operating System subject as the hardness level of MCQs have been kept to advance level.
1.A deadlock situation can arise if which of the following conditions hold simultaneously in a system:
- Mutual exclusion
- Hold and wait
- No preemption
- All of the above
D. All of the above
2.At least one resource must be held in a nonsharable 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.This condition for deadlock is refered to as :
- Mutual exclusion
- Hold and wait.
- No preemption
- Circular wait
A. Mutual exclusion
3.A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.This condition for deadlock is refered to as :
- Mutual exclusion
- Hold and wait.
- No preemption
- Circular wait
B. Hold and wait.
4.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.This condition for deadlock is refered to as :
- Mutual exclusion
- Hold and wait.
- No preemption
- Circular wait.
C. No preemption
5.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.This condition for deadlock is refered to as :
- Mutual exclusion
- Mutual exclusion
- No preemption
- Circular wait.
D. Circular wait.
6.Deadlocks can be described more precisely in terms of a directed graph called a
- Bar graph
- system resource-allocation graph
- Pie charts
- Line graphs
B. system resource-allocation graph
7.Which of the following statements is TRUE for dealing with the deadlock problem:
- We can use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a deadlocked state.
- We can allow the system to enter a deadlocked state, detect it, and recover.
- We can ignore the problem altogether and pretend that deadlocks never occur in the system.
- 1
- 1,2
- 1,2,3
- None of the above
C. 1,2,3
8.To ensure that deadlocks never occur, the system can use
- deadlock prevention scheme
- deadlock-avoidance scheme
- deadlock-detection scheme
- deadlock-recovery scheme
- 1,2
- 1,2,3
- 3,4
- 1,2,3,4
A. 1,2
1.Deadlock Prevention Scheme can applied if:
- each of the four necessary conditions must hold
- By ensuring that at least one of these conditions can hold
- By ensuring that at least one of these conditions cannot hold
- All of the above
C. By ensuring that at least one of these conditions cannot hold
2.For Deadlock Prevention which of the following condition Stands TRUE:
- The mutual exclusion condition must hold
- hold-and-wait condition never occurs in the system
- No Preemption condition does not hold
- Circular Wait condition never holds
- 1
- 1,2
- 1,2,3
- 1,2,3,4
D. 1,2,3,4
3.In Deadlock Prevention Scheme ,The mutual exclusion condition must hold if:
- at least one resource must be nonsharable
- at least one resource must be sharable
- whenever a process requests a resource, it does not hold any other resources
- All of the above
A. at least one resource must be nonsharable
4.In Deadlock Prevention Scheme ,To ensure that the hold-and-wait condition never occurs in the system if:
- at least one resource must be nonsharable
- at least one resource must be sharable
- whenever a process requests a resource, it does not hold any other resources
- All of the above
C. whenever a process requests a resource, it does not hold any other resources
5.To ensure that the hold-and-wait condition never occurs in the system Which of the following protocol should be used
- each process to request and be allocated all its resources before it begins execution. We can implement this provision by requiring that system calls requesting resources for a process precede all other system calls.
- protocol allows a process to request resources only when it has none. A process may request some resources and use them. Before it can request any additional resources, it must release all the resources that it is currently allocated.
- If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
- A and B Both
C. If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
6.To ensure that the hold-and-wait condition never occurs in the system In Deadlock Prevention Scheme,which of the following is the major disadvantages of the protocol used.
- Swapping
- resource utilization may be low,
- starvation
- page fault
- 1,2
- 1,2,3
- 2,3
- 2,3,4
C. 2,3 Explanation :
7.The third necessary condition for deadlocks is that there be no preemption of resources that have already been allocated. To ensure that this condition does not hold, Which of the following protocol should be used.
- each process to request and be allocated all its resources before it begins execution. We can implement this provision by requiring that system calls requesting resources for a process precede all other system calls.
- protocol allows a process to request resources only when it has none. A process may request some resources and use them. Before it can request any additional resources, it must release all the resources that it is currently allocated.
- If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
- All of the above
C. If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
8.If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted.This protocol is often applied to resources like
- CPU register
- memory space
- mutex locks
- semaphores
- 1 and 2
- 3 and 4
- 1,2,3
- 2,3,4
A. 1 and 2
9.The fourth and final condition for deadlocks is the circular-wait condition. One way to ensure that this condition never holds .Which of the following protocol should be used.
- a process requesting an instance of resource type Rj must have released any resources Ri such that F(Ri) ≥ F(Rj).
- protocol allows a process to request resources only when it has none. A process may request some resources and use them. Before it can request any additional resources, it must release all the resources that it is currently allocated.
- If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
- Each process can request resources only in an increasing order of enumeration. That is, a process can initially request any number of instances of a resource type —say, Ri. After that, the process can request instances of resource type Rj if and only if F(Rj) > F(Ri).
- 1,2
- 1,3
- 1,4
- 3,4
C. 1,4
10.Prevent deadlocks by limiting how requests can be made. The limits ensure that at least one of the necessary conditions for deadlock cannot occur. Possible side effects of preventing deadlocks by this method are:
- Low device utilization
- Reduced system throughput.
- Starvation
- Page fault
- 1,2
- 1, 2, 3
- 1, 2, 4
- All of the above
B. 1, 2, 3
1.An alternative method for avoiding deadlocks is
- by limiting how requests can be made.
- to require additional information about how resources are to be requested
- a and b
- None of the above
B. to require additional information about how resources are to be requested
2.avoiding deadlocks is to require additional information about how resources are to be requested .In order to avoid a possible future deadlock which of the following information is required?
- Each request requires that in making this decision the system consider the resources currently available
- the resources currently allocated to each process
- the future requests and releases of each process.
- All of the above
D. All of the above
3.avoiding deadlocks ,The simplest and most useful model requires that each process declare the ____ of resources of each type that it may need
- Minimum Number
- maximum number
- Average Number
- None of the above
B. maximum number
4.A deadlock-avoidance algorithm dynamically examines the ____ to ensure that a circular-wait condition can never exist.
- resource-allocation state
- resource-available state
- resource-Utilization state
- All of the above
A. resource-allocation state
5.In A deadlock-avoidance algorithm The resource allocation state is defined by
- the number of available resources
- the allocated resources
- the maximum demands of the processes
- all of the above
D. all of the above
6.In A deadlock-avoidance algorithm A state is safe if
- there exists a safe sequence
- the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock
- A and B both
- None of the above
C. A and B both
7.consider a system with twelve magnetic tape drives and three processes: P0, P1, and P2. Process P0 requires ten tape drives, process P1 may need as many as four tape drives, and process P2 may need up to nine tape drives. Suppose that, at time t0, process P0 is holding five tape drives, process P1 is holding two tape drives, and process P2 is holding two tape drives. (Thus, there are three free tape drives.)
Maximum Needs Current Needs
P0 10 5
P1 4 2
P2 9 2
At time t0, Which of the following sequence is a safe sequence ?
Maximum Needs Current Needs
P0 10 5
P1 4 2
P2 9 2
At time t0, Which of the following sequence is a safe sequence ?
- P0, P1, P2
- P1, P0, P2
- P2, P0, P1
- P1, P2, P0
B. P1, P0, P2 Explanation :
8.Which of the following stands true for Resource-allocation graph for deadlock avoidance.
- An algorithm for detecting a cycle in this graph requires an order of n^2 operations, where n is the number of processes in the system
- If no cycle exists, then the allocation of the resource will leave the system in a safe state.
- If a cycle is found, then the allocation will put the system in an unsafe state
- All of the above
D. All of the above
9.The resource-allocation-graph algorithm is not applicable to___
- a resource allocation system with single instances of each resource type
- a resource allocation system with multiple instances of each resource type
- a resource allocation system with Single and multiple instances of each resource type
- All of the above
B. a resource allocation system with multiple instances of each resource type
10.which of the following statement is True for Banker algorithm for deadlock-avoidance.
- When a new process enters the system, it must declare the maximum number of instances of each resource type that it may need. This number may not exceed the total number of resources in the system
- It allows a process to request resources only when it has none. A process may request some resources and use them. Before it can request any additional resources, it must release all the resources that it is currently allocated.
- If a process is holding some resources and requests another resource that cannot be immediately allocated to it (that is, the process must wait), then all resources the process is currently holding are preempted
- All of the above
A. When a new process enters the system, it must declare the maximum number of instances of each resource type that it may need. This number may not exceed the total number of resources in the system
11.Which of the following data structures must be maintained to implement the banker’s algorithm , where n is the number of processes in the system and m is the number of resource types:
- A vector of length m indicates the number of available resources of each type. If Available[j] equals k, then k instances of resource type Rj are available.
- An n × m matrix defines the maximum demand of each process. If Max[i][j] equals k, then process Pi may request at most k instances of resource type Rj
- An n × m matrix defines the number of resources of each type currently allocated to each process. If Allocation[i][j] equals k, then process Pi is currently allocated k instances of resource type Rj.
- An n × m matrix indicates the remaining resource need of each process. If Need[i][j] equals k, then process Pi may need k more instances of resource type Rj to complete its task. Note that Need[i][j] equals Max[i][j] − Allocation[i][j].
- 1
- 1,2
- 1,2,3
- 1,2,3,4
D. 1,2,3,4
1.In Deadlock Detection Algorithm The wait-for graph scheme is applicable to
- a resource-allocation system with multiple instances of each resource type
- a resource-allocation system with Single instances of each resource type
- A and B
- None of the above
B. a resource-allocation system with Single instances of each resource type
2.wait-for graph can be obtained from the resource-allocation graph by
- removing the resource nodes and collapsing the appropriate edges.
- collapsing the resource nodes and removing the appropriate edges.
- A and B
- None of the above
A. removing the resource nodes and collapsing the appropriate edges.
3.an edge from Pi to Pj in a wait-for graph implies that
- process Pj is waiting for process Pi to release a resource that Pi needs
- process Pj is waiting for process Pi to release a resource that Pi needs
- process Pi is waiting for process Pj to release a resource that Pj needs
- process Pi is waiting for process Pj to release a resource that Pi needs
D. process Pi is waiting for process Pj to release a resource that Pi needs
4.An edge Pi → Pj exists in a wait-for graph if and only if
- the corresponding resource allocation graph contains two edges Pj → Rq and Rq → Pi for some resource Rq
- the corresponding resource allocation graph contains two edges Rq → pi and Pi → Rq for some resource Rq
- the corresponding resource allocation graph contains two edges Pi → Rq and Rq → Pj for some resource Rq
- All of the above
C. the corresponding resource allocation graph contains two edges Pi → Rq and Rq → Pj for some resource Rq
5.a deadlock exists in the system if and only if the wait-for graph contains a
- Cycle
- No Cycle
- Square
- All of the above
A. Cycle
6.To detect deadlocks, the system needs to maintain the wait for graph and periodically invoke an algorithm that searches for a cycle in the graph. An algorithm to detect a cycle in a graph requires an
- order of n2 operations, where n is the number of vertices in the graph.
- order of n^2 operations, where n is the number of vertices in the graph.
- order of n2 operations, where n is the number of edges in the graph.
- order of n^2 operations, where n is the number of edges in the graph
B. order of n^2 operations, where n is the number of vertices in the graph.
7.When should we invoke the detection algorithm?
- How often is a deadlock likely to occur?
- How many processes will be affected by deadlock when it happens?
- All of the above
- None of the above
C. All of the above Explanation :
8.invoking the deadlock-detection algorithm for every resource request will incur considerable overhead in
- seek time
- invoke time
- computation time
- All of the above
C. computation time Explanation :
1.Which of the following is options for breaking a deadlock
- simply abort one Process
- simply abort one or more processes to break the circular wait
- preempt some resources from one or more of the deadlocked processes
- All of the above
D. All of the above
2.which of the following method can be used to eliminate deadlock under process termination
- Abort all deadlocked processes
- Abort one process at a time until the deadlock cycle is eliminated
- It is not possible to abort all deadlocked process
- A and B
D. A and B
3.In which of the following method after each process is aborted, a deadlock-detection algorithm must be invoked to determine whether any processes are still deadlocked.
- Abort all deadlocked processes
- Abort one process at a time until the deadlock cycle is eliminated
- preempt some resources from one or more of the deadlocked processes
- None of the above
B. Abort one process at a time until the deadlock cycle is eliminated
4.we should abort those processes whose termination will incur
- the average cost
- the Maximum cost
- the minimum cost
- None of the above
C. the minimum cost
5.Many factors may affect which process is chosen for termination, including:
- What the priority of the process is
- How long the process has computed and how much longer the process will compute before completing its designated task
- How many and what types of resources the process has used (for example,whether the resources are simple to preempt)
- All of the above
D. All of the above
6.If preemption is required to deal with deadlocks, which of the following issues need to be addressed:
- Selecting a victim
- Rollback
- Starvation
- All of the above
D. All of the above
7.Which resources and which processes are to be preempted? As in process termination, we must determine the order of preemption to minimize cost. Cost factors may include which of the below parameters
- as the number of resources a deadlocked process is holding
- the amount of time the process has thus far consumed.
- A and B
- None of the above
C. A and B
8.If we preempt a resource from a process, Which of the following stands true?
- it cannot continue with its normal execution; it is missing some needed resource.
- We must roll back the process to some safe state and restart it from that state
- it can continue with its normal execution; it is missing some needed resource.
- We should not roll back the process to some safe state and restart it from that state
- 1
- 1,2
- 2,3
- 3,4
B. 1,2
9.Which of the following method requires the system to keep more information about the state of all running processes to break the deadlock in Resource Preemption
- Selecting a victim
- Rollback
- Starvation
- deadlock-detection
B. Rollback Explanation :
10.In Resource preemtion which of the following causes starvation to occur
- resources are always preempted from the same process
- resources will not always be preempted from the same process
- Abort all deadlocked processes
- Abort one process at a time until the deadlock cycle is eliminated
A. resources are always preempted from the same process
11.Which following is the solution to starvation problem in resource preemtion
- the same process is always picked as a victim
- we must ensure that a process can be picked as a victim only a (small) finite number of times
- A and B both
- None of the above
B. we must ensure that a process can be picked as a victim only a (small) finite number of times
Post a Comment