RDBMS : Recovery From Deadlock
Once it is determined that a deadlock exitx, the system needs to recover from the deadlock. For this, one or more transactions are rolled back to break the deadlock. While performing the roll back operation, the following issues need to be addressed :
a. Selection of a victim : in the situation of a deadlock, you first need to determine the transaction (or transaction) that should be rolled back to break the deadlock. Such a transaction is called the victim transaction. The transaction that will lead to minimum loss, in terms of cost, should be chosen for rollback. The following factors determine the cost of a rollback :
How much execution has the transaction completed and for how much more time the transaction will execute to complete its task?
How many data items were used by the transaction?
How many more data items does the transaction need to complete?
How many transaction will be included in the rollback?
b. Rollback : after determining the transaction to be rolled back, you need to determine how far the transaction is to be rolled back. The easlest answer to this problem is to do a total rollback, which means that the transaction will be aborted and restarted. However, it is better to roll back the transaction only till the point where the deadlock can be broken. This method requires the DBMS to maintain information about all current transaction.
c. Starvation : when the selection of a victim is based on cost factors, it might happen ihat the same transaction is selected as a victim every time a deadlock occurs. Due to this, the transaction might not be able to complete its task. Such a situation is called starvation. To avoid starvation, you need to ensure that a transaction is picked as a victim for only a fixed number of times. To ensure this, you can select a victim based on the number of rollbacks along with the cost factor.
a. Selection of a victim : in the situation of a deadlock, you first need to determine the transaction (or transaction) that should be rolled back to break the deadlock. Such a transaction is called the victim transaction. The transaction that will lead to minimum loss, in terms of cost, should be chosen for rollback. The following factors determine the cost of a rollback :
How much execution has the transaction completed and for how much more time the transaction will execute to complete its task?
How many data items were used by the transaction?
How many more data items does the transaction need to complete?
How many transaction will be included in the rollback?
b. Rollback : after determining the transaction to be rolled back, you need to determine how far the transaction is to be rolled back. The easlest answer to this problem is to do a total rollback, which means that the transaction will be aborted and restarted. However, it is better to roll back the transaction only till the point where the deadlock can be broken. This method requires the DBMS to maintain information about all current transaction.
c. Starvation : when the selection of a victim is based on cost factors, it might happen ihat the same transaction is selected as a victim every time a deadlock occurs. Due to this, the transaction might not be able to complete its task. Such a situation is called starvation. To avoid starvation, you need to ensure that a transaction is picked as a victim for only a fixed number of times. To ensure this, you can select a victim based on the number of rollbacks along with the cost factor.
3 Comments:
thank u vey much..was helpful...
By Anonymous, At 4:34 AM
Thank you Very much For notes it was helpful for my exam
.
By Sathish, At 6:23 AM
Thank you for help
By Rajdeep, At 12:13 AM
Post a Comment
Subscribe to Post Comments [Atom]
<< Home