Deadlocks in DBMS

Deadlocks in DBMS

Q. What is  Deadlocks in DBMS ? Explain Deadlock detection and prevention in details.

Ans :-
1) A deadlock is a condition in which two or more transactions in a set are waiting simultaneously for lock held by some other transaction in the set. 

2)No one transaction can continue because each transaction in the set is on the queue, waiting for other transaction complete and released the lock. 


3)In other words deadlocks is a state each member waiting for other member to take a action.


4) In dead lock transactions are mutually excluded from accessing the next record required to complete their transaction. 

5) Dead lock a circular waiting condition and it is  one of the most feared complication in DBMS. Hence, it is also called deadly embrace.

6)A deadlock exists when two transaction T1 and T2 exist in the following mode:


Fig:Deadlock Situation

  • Deadlock Prevention 
1) Deadlock prevention mean never allow deadlock.

2)In deadlock prevention avoid the condition  that lead to deadlock, Science, here resources is allowed in such a way the dead lock never occur.

3)In this every transaction lock all data it needs in advance. if a single  data item cannot be obtained, none of the items are locked.

4) Deadlock prevention suitable for large database

5) Wait-die  and  Wound wait schemes  are used for deadlock prevention.

  • Deadlock Avoidance
1) Deadlock avoidance means detect deadlocks periodically.

2) In deadlock avoidance technique transaction must obtain all the locks it needs before it can be executed.

3)It is always better to avoid the deadlock rather than aborting and restring database.

4)The ideal period i that,on an average detects  one deadlock cycle.

5) One of the best method of deadlock avoidance  application consistence logic.

6) Deadlock avoidance is suitable for small database.

  • Deadlock Detection
1) Deadlock detection means detect deadlock whenever a transaction is blocked.

2) For deadlock detection DBMS is  periodic check some resources exceeds a predetermined limit. 


3) In DBMS if deadlock is found, then one of the transaction is aborted and the other transaction continues.

4) The aborted transaction is now rolled back and restarted.


5) Wait-for -graph is one of the  method of deadlock detection. Deadlock detection is expensive.
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Important of Database privilages

Database privileges Privileges are the right or permission to execute particular SQL statements.                           System Se...