Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?

Deadlock Blocking Locking


When the client application is waiting for a require resource, Timeout occurs.

There are multiple reasons for Timeout like: transaction blocking, the distance of network, high CPU utilization and multiple request user request at one time.

The Database Timeout cannot affect to other running connection and it treated independently, but for solving the Timeout issue we need to check other causes like: OS response, Network response, Database Timeout threshold value, number of Database Connections and other.


When one process is accessing an object, it can request for a lock for that particular object so that other processes cannot perform read or update on that object.

There are different types of lock like: Exclusive Lock, Non-exclusive Lock.

An Exclusive Lock prevents object or data from the reading and writing both the action.
A Non-Exclusive Lock allows read-only access for an object or data, but it prevents the write action for an object or data.


If two processes are accessing same resource so at that time one process has to wait until the other process release the occupied resource.

This is called blocking because one transaction is blocked by another transaction and all blocked processes kept in the waiting queue.

If the blocked transaction is waiting for a long time, it may generate a Database Timeout.
If the long running blocked transaction requires a lock, it may generate a Database Deadlock.

Deadlock:Database Deadlock

One X blocked process is waiting to complete the transaction of the Y process and the same time, Y process is blocked because it is also waiting to complete the transaction of the X process.
This is called as Deadlock situation.


In the Deadlock situation, both the processes trying to access a particular resource and also having a lock on that resource by each other so both are waiting for each other to release a lock and complete the transaction.

Deadlock is a next stage of the blocking situation so if you want to avoid Deadlock situation, you should first find the blocked transaction and tried to remove internal dependency of the transactions.

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of