SQL SERVER 2008 – What is a deadlock and what is a live lock? How will you go about resolving deadlocks

Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other’s piece.

Each process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. SQL Server detects deadlocks and terminates one user’s process. A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely. Check out SET DEADLOCK_PRIORITY and “Minimizing Deadlocks” in SQL Server books online.

Also check out the article Q169960 from Microsoft knowledge base.

Reference : Dilip Kumar Jena ( https://sqlexplore.wordpress.com )

Advertisements

One thought on “SQL SERVER 2008 – What is a deadlock and what is a live lock? How will you go about resolving deadlocks

  1. SQL Server detects the situation after four denials and refuses further shared locks. –How come you know Only 4 attempts are there. This is false.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s