How to Recovery from Deadlock





Recovery from Deadlock :-
·       When a detection algorithm determined that a deadlock exists, the system myst recover from the deadlock.
·       The most common solution is to roll back one or more transactions to break the deadlock. Three actions need to be taken:




11     Selection of a victim :-
·       Given a set of deadlocked transaction, we must determine which transaction to rollback to break the deadlock.
·       We should rollback those transactions that will incur the minimum cost.
·       Unfortunately, the term minium cost is not a precise one, many factors may determine the cost of a rollback, including
a.      How long the transaction has computed, and how much longer the transaction will compute before it completes its designated task.
b.     How many data items the transaction has used.
c.      How many more data items the transaction needs for it to complete.
d.     How many transactions will be involved in the rollback.
22   Rollback:
·       Once we have decided that a particular transaction must be rolled back, we must determine how far this transaction should be rolled back.
·       The simplest solution is a total rollback: Abort the transaction and the restart it.
·       However, it is more effective to roll back the transaction only as far as necessary to break the deadlock.
·       Such partial rollback requires the system to maintain additional information about the state of all the running transaction.
·       Specially, the sequence of lock requests/grants and updates performed by the transaction needs to be recorded.
·       The deadlock detection mechanism should decide which locks the selected transaction needs to release in order to break the deadlock.
·       The recovery mechanism must be capable of performing such partial rollbacks.
33    Starvation :-
·       In a system where the selection of victims is based primarily on cost factors, it may happen that the same transaction is always picked as a victim.
·       As a result, this transaction never completes its designated task, thus there is starvation.
·       We must ensure that a transaction can be picked as a victim only a finite number of times.
·       The mist common solution is to include the number of rollbacks in the cost factor.
How to Recovery from Deadlock How to Recovery from Deadlock Reviewed by Unknown on 04:05:00 Rating: 5

No comments:

Powered by Blogger.