šŸŽ“ BookMCQ
← Back to 7. Deadlocks

šŸ“ Deadlock Detection Algorithm Usage (43 MCQs)

šŸ“– From Operating System • 7. Deadlocks • 43 questions available

What is Deadlock Detection Algorithm Usage?

Definition:
The frequency and timing of detection algorithm invocation involve trade-offs between detection latency, CPU overhead, and number of affected processes.

Example:
Running detection only when CPU utilization drops below threshold τ\tau reduces overhead compared to periodic execution every Δt\Delta t.

Reason:
Optimal usage policy minimizes performance impact while ensuring deadlocks are detected promptly enough to limit damage and recovery cost.

3
Easy
26
Medium
14
Hard

šŸ“ All Deadlock Detection Algorithm Usage MCQs

Q1. What are the two primary factors determining how often to invoke the deadlock detection algorithm?

A.CPU speed and memory size.
B.How often deadlocks occur and how many processes are affected. āœ…
C.Number of resources and number of users.
D.Disk space and network bandwidth.
šŸ’” Difficulty: easy | āœ… Correct: B

šŸ“– Explanation: The text explicitly states that the invocation frequency depends on the likelihood of deadlock occurrence and the number of processes affected when it happens.

Q2. If deadlocks occur frequently, how should the detection algorithm be invoked?

A.Rarely
B.Infrequently
C.Frequently āœ…
D.Never
šŸ’” Difficulty: easy | āœ… Correct: C

šŸ“– Explanation: Frequent deadlocks mean resources are often tied up idly. To minimize this waste and prevent the deadlock cycle from growing, the detection algorithm should be run frequently to resolve issues quickly.

Q3. What happens to resources allocated to deadlocked processes?

A.They are used efficiently.
B.They remain idle until the deadlock is broken. āœ…
C.They are automatically released.
D.They are shared with other processes.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Processes in a deadlock are blocked and cannot proceed. Therefore, any resources they hold are unused (idle) and unavailable to other processes until the deadlock is resolved.

Q4. Why is it problematic if the number of processes in a deadlock cycle grows?

A.It makes the system faster.
B.It increases the number of idle resources and complicates recovery. āœ…
C.It reduces CPU usage significantly.
D.It simplifies the detection algorithm.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: As more processes join the deadlock cycle, more resources become idle, reducing system throughput. Additionally, recovering from a large deadlock (e.g., terminating many processes) is more costly and disruptive than resolving a small one.

Q5. When does a deadlock typically occur in terms of resource requests?

A.When a request is granted immediately.
B.When a request cannot be granted immediately. āœ…
C.When a process starts.
D.When a process finishes.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Deadlocks arise when a process requests a resource that is not available and is held by another waiting process, creating a chain. The final request that cannot be granted completes the circular wait.

Q6. What is the benefit of invoking the detection algorithm every time a request cannot be granted?

A.It reduces computational overhead.
B.It identifies the specific process that 'caused' the deadlock. āœ…
C.It prevents deadlocks entirely.
D.It allows more resources to be allocated.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: By running detection immediately upon a failed request, the system can pinpoint the most recent request as the one that completed the cycle. This helps identify the 'triggering' process for potential recovery actions.

Q7. What is the main disadvantage of invoking the detection algorithm on every failed request?

A.It misses some deadlocks.
B.It incurs considerable computational overhead. āœ…
C.It is too slow to detect cycles.
D.It requires manual intervention.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Running the detection algorithm (which can be O(n²) or O(m*n²)) for every single resource request adds significant processing time to each request, slowing down overall system performance.

Q8. Which strategy is considered less expensive than checking every request?

A.Checking every minute.
B.Invoking the algorithm at defined intervals or based on system metrics. āœ…
C.Checking only at startup.
D.Checking only when the system crashes.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Periodic checks (e.g., hourly) or trigger-based checks (e.g., low CPU usage) reduce the frequency of running the expensive detection algorithm, saving computational resources.

Q9. Why might CPU utilization drop during a deadlock?

A.Because the CPU is working harder.
B.Because deadlocked processes are waiting and not executing instructions. āœ…
C.Because the CPU is overheating.
D.Because the disk is full.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Deadlocked processes are blocked, waiting for resources. They do not perform useful work, leading to lower CPU utilization as the CPU may have no ready processes to run.

Q10. If the detection algorithm is invoked at arbitrary points, what is a likely consequence regarding causality?

A.The causing process is easily identified.
B.It is difficult to tell which process 'caused' the deadlock. āœ…
C.No process is responsible.
D.The system automatically fixes it.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: If time has passed since the deadlock formed, multiple cycles may exist, and many processes may be involved. It becomes ambiguous which specific request triggered the deadlock, making 'blame' assignment difficult.

Q11. In reality, who causes a deadlock?

A.The last process to request a resource.
B.The first process to request a resource.
C.All processes in the cycle jointly. āœ…
D.The operating system.
šŸ’” Difficulty: hard | āœ… Correct: C

šŸ“– Explanation: While we often blame the last requester for simplicity, a deadlock is a circular dependency. Every process in the cycle holds a resource needed by the next, so they all jointly contribute to the deadlock condition.

Q12. Can a single resource request create multiple cycles?

A.No, only one.
B.Yes, if there are many resource types. āœ…
C.Only if the system is safe.
D.Only if there are two processes.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: In complex systems with many resource types and dependencies, one new request might complete several different circular chains simultaneously, creating multiple cycles in the resource graph.

Q13. What is a common metric used to trigger deadlock detection periodically?

A.Memory usage above 90%.
B.CPU utilization dropping below a threshold (e.g., 40%). āœ…
C.Disk I/O increasing.
D.Network latency decreasing.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: A significant drop in CPU utilization often indicates that many processes are blocked (waiting), which is a symptom of deadlock. Thus, it serves as a practical trigger for detection.

Q14. If deadlocks are rare, which invocation strategy is most efficient?

A.Check every request.
B.Check periodically. āœ…
C.Check continuously.
D.Check never.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: If deadlocks are rare, the overhead of checking every request is wasted. Periodic checking balances the low risk of deadlock with the cost of detection, avoiding unnecessary computation.

Q15. What is the 'extreme' case for invoking the detection algorithm?

A.Once a year.
B.Every time a request cannot be granted immediately. āœ…
C.Only when the user complains.
D.At system shutdown.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: The text describes invoking the algorithm on every failed allocation request as the 'extreme' approach, offering maximum responsiveness at the cost of maximum overhead.

Q16. Why is identifying the 'causing' process useful?

A.To punish the process.
B.To aid in recovery decisions, such as which process to terminate. āœ…
C.To speed up the CPU.
D.To allocate more resources.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Knowing which process triggered the deadlock can help the recovery algorithm decide which victim to select. For example, terminating the triggering process might break the cycle with minimal disruption if it was the last link added.

Q17. If the detection algorithm is run infrequently, what risk increases?

A.The system becomes faster.
B.The deadlock may involve more processes and resources before detection. āœ…
C.The CPU usage increases.
D.The memory fills up.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Infrequent detection means a deadlock can persist for longer. During this time, other processes may request resources held by the deadlocked set, potentially joining the deadlock or being blocked by it, expanding the scope of the problem.

Q18. What does the phrase 'resources allocated to deadlocked processes will be idle' imply?

A.Wasted system capacity. āœ…
B.Efficient resource management.
C.High throughput.
D.Low memory usage.
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: Idle resources are those that are allocated but not being used productively because the holding process is stuck. This represents a loss of potential system capacity and efficiency.

Q19. Which statement best describes the trade-off in detection frequency?

A.Higher frequency improves accuracy but increases overhead. āœ…
B.Higher frequency reduces overhead but increases deadlock duration.
C.Lower frequency improves identification of causes.
D.Lower frequency increases CPU usage.
šŸ’” Difficulty: hard | āœ… Correct: A

šŸ“– Explanation: Frequent detection catches deadlocks early (accurate/timely) but costs more CPU time (overhead). Infrequent detection saves CPU time but allows deadlocks to persist and grow (less timely).

Q20. If CPU utilization is high, does it mean there is no deadlock?

A.Yes, always.
B.No, but it makes deadlock less likely as processes are running. āœ…
C.Yes, because deadlocks lower CPU usage.
D.No, deadlocks increase CPU usage.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: High CPU utilization suggests processes are actively executing. While a partial deadlock might exist, a total system deadlock usually results in low CPU usage. However, high CPU doesn't guarantee *no* deadlock (e.g., if non-deadlocked processes are busy).

Q21. What is the role of the 'most recent request' in deadlock identification?

A.It is ignored.
B.It is often identified as the 'cause' for practical purposes. āœ…
C.It is always the victim.
D.It is granted automatically.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Since the most recent request completed the cycle, it is convenient to label it as the 'cause'. This simplifies recovery logic, even though technically all parties are responsible.

Q22. Why is it difficult to identify the causing process if many cycles exist?

A.Because there are too many processes.
B.Because multiple requests contributed to different cycles, blurring responsibility. āœ…
C.Because the system crashes.
D.Because the logs are deleted.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: With multiple cycles, there isn't a single 'last' request that caused everything. Several requests may have completed different cycles simultaneously or in quick succession, making it hard to pinpoint a single culprit.

Q23. What is the impact of deadlock on system throughput?

A.It increases throughput.
B.It has no effect.
C.It cripples throughput. āœ…
D.It stabilizes throughput.
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: Deadlocked processes do no useful work. If many processes are deadlocked, the amount of work completed by the system (throughput) drops significantly.

Q24. If a system has few resource types, how does this affect cycle creation?

A.One request is less likely to create many cycles. āœ…
B.One request always creates many cycles.
C.It has no effect.
D.It prevents deadlocks.
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: With fewer resource types, the dependency graph is simpler. A single request is less likely to intersect with multiple independent waiting chains, reducing the chance of creating multiple distinct cycles at once.

Q25. What is the primary goal of tuning the detection frequency?

A.To eliminate all deadlocks.
B.To balance detection overhead with the cost of deadlocked resources. āœ…
C.To maximize CPU usage.
D.To minimize memory usage.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: The goal is optimization. Running detection too often wastes CPU; running it too rarely wastes resources held by deadlocks. Tuning finds the sweet spot where total system cost (overhead + deadlock loss) is minimized.

Q26. Can the detection algorithm prevent deadlocks?

A.Yes, if run frequently.
B.No, it only detects them after they occur. āœ…
C.Yes, if it identifies the cause.
D.No, it only avoids them.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Detection is a reactive measure. It finds deadlocks that have already happened. Prevention and avoidance are proactive measures that stop deadlocks from forming.

Q27. If a request is granted immediately, is detection invoked in the 'every request' strategy?

A.Yes
B.No āœ…
C.Only if CPU is low
D.Only if memory is full
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: The strategy specifies invocation when a request *cannot* be granted immediately. If granted, no wait occurs, so no deadlock is formed by that request, and detection is skipped to save overhead.

Q28. What does 'arbitrary points in time' refer to in the context of detection?

A.Randomized intervals. āœ…
B.Fixed schedules like once per hour.
C.Event-driven triggers like low CPU.
D.Every request.
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: Arbitrary points imply no strict logical trigger related to system state changes (like requests) or regular intervals. It might mean random checks or checks based on loose criteria, making causality hard to trace.

Q29. Why is the 'once per hour' example given?

A.It is the only valid interval.
B.It illustrates a periodic, less expensive alternative. āœ…
C.It is the fastest method.
D.It is required by law.
šŸ’” Difficulty: easy | āœ… Correct: B

šŸ“– Explanation: The text uses 'once per hour' as an example of a periodic strategy, contrasting it with the high-overhead 'every request' strategy. It shows a way to reduce computational cost.

Q30. If a deadlock involves 10 processes, how many resources are likely idle?

A.None
B.At least 10 (one per process) āœ…
C.Exactly 1
D.Depends on CPU
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: In a simple cycle, each process holds at least one resource. So 10 processes would hold at least 10 resources. These resources are idle because the processes are blocked. Complex cases might involve more resources per process.

Q31. What is the relationship between deadlock frequency and detection cost?

A.High frequency justifies high detection cost. āœ…
B.Low frequency justifies high detection cost.
C.High frequency requires low detection cost.
D.There is no relationship.
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: If deadlocks are frequent, the cost of idle resources is high. Therefore, paying the higher computational cost of frequent detection is justified to minimize resource waste.

Q32. Which factor suggests using a periodic detection strategy?

A.Deadlocks are very frequent.
B.Deadlocks are rare. āœ…
C.CPU is always 100%.
D.Memory is always full.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: If deadlocks are rare, the cost of frequent detection outweighs the benefit. Periodic detection is sufficient to catch the occasional deadlock without wasting resources on constant checks.

Q33. What is the 'chain of waiting processes'?

A.A linked list in memory.
B.A sequence of processes where each waits for the next. āœ…
C.A queue of ready processes.
D.A list of finished processes.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: A deadlock often forms a chain: P1 waits for P2, P2 waits for P3, ..., Pn waits for P1. This circular chain is the structural basis of the deadlock.

Q34. If the detection algorithm is invoked on every failed request, what can be identified?

A.Only the existence of deadlock.
B.The specific process that completed the cycle. āœ…
C.The future resource needs.
D.The maximum demand.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Immediate invocation allows the system to correlate the current failed request with the newly formed cycle, identifying the requesting process as the one that 'completed' the deadlock.

Q35. Why is CPU utilization < 40% a good trigger?

A.It is a random number.
B.It indicates a significant drop in activity, suggesting blocking. āœ…
C.It is the maximum CPU speed.
D.It is the minimum memory requirement.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: A drop below a normal baseline (like 40%) suggests that processes are not running because they are waiting (blocked). This is a strong heuristic for potential deadlock.

Q36. What is the main drawback of periodic detection?

A.It is too fast.
B.It may allow deadlocks to persist and grow between checks. āœ…
C.It uses too much CPU.
D.It identifies the cause too easily.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Between periodic checks, a deadlock can exist for minutes or hours. During this time, more processes may get stuck, and resources remain idle, increasing the negative impact.

Q37. Can a process be part of a deadlock but not be the 'causing' process?

A.Yes āœ…
B.No
C.Only if it is old
D.Only if it is new
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: Yes. In a cycle, all processes are equally responsible. The 'causing' label is often assigned to the last requester for convenience, but earlier participants are also part of the deadlock.

Q38. What is the effect of 'considerable overhead' on system performance?

A.It improves response time.
B.It slows down resource request handling. āœ…
C.It increases memory.
D.It speeds up disk access.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Overhead means extra computation. If the detection algorithm runs frequently, each resource request takes longer to process, increasing latency and reducing overall system responsiveness.

Q39. If a system has high deadlock frequency, what is the likely impact on resource utilization?

A.High utilization of useful work.
B.Low effective utilization due to idle locked resources. āœ…
C.No impact.
D.Increased utilization.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Although resources are 'allocated', they are not doing useful work. Thus, the *effective* utilization (productive work) is low, even if the *allocation* rate is high.

Q40. Which strategy provides the best information for recovery?

A.Periodic.
B.On every failed request. āœ…
C.Random.
D.Never.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Identifying the specific 'causing' process (possible with immediate detection) gives the recovery algorithm a better target for termination or preemption, potentially minimizing disruption.

Q41. What is the 'resource graph' mentioned in the text?

A.The Wait-For Graph or Resource-Allocation Graph. āœ…
B.The network topology.
C.The file system structure.
D.The memory map.
šŸ’” Difficulty: medium | āœ… Correct: A

šŸ“– Explanation: The resource graph refers to the graphical representation of resource allocation (RAG) or waiting (WFG), where cycles indicate deadlocks.

Q42. If multiple cycles exist, how many processes are deadlocked?

A.Only one per cycle.
B.All processes involved in any of the cycles. āœ…
C.Only the last process.
D.None.
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: Any process participating in a cycle is deadlocked. If there are multiple disjoint or overlapping cycles, all unique processes involved in any of those cycles are considered deadlocked.

Q43. Why is the 'extreme' strategy rarely used in practice?

A.It is too inaccurate.
B.The computational cost is prohibitive for high-traffic systems. āœ…
C.It requires special hardware.
D.It does not work.
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: For systems with thousands of requests per second, running a complex detection algorithm for every failed request would consume too much CPU, degrading performance for all users.

šŸ”— Related Topics (MCQs)