HomeTechnologyDatabasesWhat is Deadlock?
Technology·2 min·Updated Mar 9, 2026

What is Deadlock?

Deadlock

Quick Answer

A deadlock occurs when two or more processes are unable to proceed because each is waiting for the other to release a resource. This situation creates a standstill, preventing any of the involved processes from continuing their work.

Overview

In computer science, a deadlock is a condition where two or more processes cannot move forward because they are each waiting for the other to release resources. This often happens in database systems where multiple transactions are trying to access the same data. For instance, if Transaction A holds a lock on Resource 1 and is waiting for Resource 2, while Transaction B holds a lock on Resource 2 and is waiting for Resource 1, neither can proceed, leading to a deadlock. Deadlocks are critical to understand in the context of databases because they can significantly impact performance and data integrity. When a deadlock occurs, it can halt operations, causing delays and requiring intervention to resolve the situation. Database management systems often implement strategies to detect and resolve deadlocks, such as timeout mechanisms or deadlock detection algorithms that identify and terminate one of the processes to break the cycle. Preventing deadlocks is essential for maintaining smooth database operations. Techniques such as resource ordering, where resources are always requested in a specific order, can help reduce the chances of deadlocks occurring. By effectively managing how resources are allocated and accessed, database administrators can minimize the risk of deadlocks and ensure that transactions complete efficiently.


Frequently Asked Questions

Deadlocks are typically caused by processes holding resources while waiting for other resources that are held by other processes. This mutual waiting creates a cycle that prevents any of the processes from progressing.
Deadlocks can be detected using algorithms that monitor resource allocation and process states. These algorithms check for cycles in the resource allocation graph, indicating that a deadlock has occurred.
To resolve a deadlock, one of the processes involved can be terminated or rolled back to free up resources. Alternatively, systems may implement timeout strategies to automatically release resources if a process waits too long.