Pre Test

1. What is a deadlock in concurrent computing?
Explanation:

Correct Answer: C
A deadlock occurs when two or more processes are blocked forever, waiting for each other to release resources. This creates a circular dependency where no process can proceed. The four necessary conditions for deadlock are: mutual exclusion, hold and wait, no preemption, and circular wait. Understanding deadlock is crucial for system design and resource management.

2. In deadlock detection, what does a cycle in the resource allocation graph indicate?
Explanation:

Correct Answer: B
In a resource allocation graph, a cycle indicates a potential deadlock situation. The graph consists of processes and resources connected by edges. If there's a cycle in the graph, it means processes are waiting for resources in a circular manner, which is the fundamental characteristic of deadlock. However, a cycle is necessary but not always sufficient for deadlock in systems with multiple instances of resource types.

3. Which of the following is an application of deadlock detection algorithms?
Explanation:

Correct Answer: B
Database management systems (DBMS) are a primary application of deadlock detection algorithms. In databases, multiple transactions may request locks on different resources (tables, rows, etc.) simultaneously, potentially creating deadlock situations. DBMS use deadlock detection algorithms to identify these situations and resolve them by aborting one of the conflicting transactions, ensuring system progress and data consistency.

4. What problem is solved by Dijkstra's banker's algorithm?
Explanation:

Correct Answer: D
Dijkstra's Banker's Algorithm is designed for deadlock avoidance, not detection or recovery. It works by ensuring the system never enters an unsafe state by carefully analyzing resource requests before granting them. The algorithm maintains information about maximum resource needs, current allocations, and available resources to determine if granting a request would leave the system in a safe state where all processes can complete.

5. Which of the following best describes the primary purpose of a deadlock detection algorithm?
Explanation:

Correct Answer: C
Deadlock detection algorithms are specifically designed to identify when deadlocks have already occurred in the system and then resolve them. Unlike prevention (which stops deadlocks from happening) or avoidance (which prevents entering unsafe states), detection allows deadlocks to occur but provides mechanisms to detect and recover from them, typically by terminating processes or preempting resources.