Cs3306 Unit 1 Research Paper

662 Words2 Pages

Unit 2 Written Assignment
Transaction Deadlock
CS3306 Databases 2
University of the People

Introduction In a multi-process system, deadlock is an unwanted situation that arises in a shared resource environment, where a process indefinitely waits for a resource that is held by another process. A deadlock occurs when two or more tasks permanently block each other by each task having a lock on a resource which the other tasks are trying to lock. When a detection algorithm determines that a deadlock exists, the system must recover from the deadlock. The most common solution is to roll back one or more transactions to break the deadlock.
There are solutions to dealing with deadlock: Selection of a victim, Rollback and …show more content…

The simplest solution is a total rollback, which aborts the transaction and then restart it. However, it is more effective to roll back the transaction only as far as necessary to break the deadlock. This is known as a partial rollback which requires the system to maintain additional information about the state of all the running transactions. The sequence of lock requests or 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 selected transaction must be rolled back to the point where it obtained the first of these locks, undoing all actions it took after that point. The recovery mechanism must be capable of performing such partial rollbacks. Furthermore, the transactions must be capable of resuming execution after a partial rollback (Silberschatz, Korth & Sudarshan, …show more content…

Starvation Starvation can occur in systems where the selection of victims is based primarily on cost factors, that is, there is a high possibility that the same transaction is always picked as a victim. The downside to this is that this transaction may never get to complete its designated task, leading to the issue of starvation. Therefore, mechanisms must be put in place to ensure that transaction can be picked as a victim only a (small) finite number of times. Including the number of rollbacks in the cost factor is a common strategy used to deal with the issue.
Conclusion
The graph in figure 16.18 does not have any cycles and therefore it is not in a deadlock state. However, connecting T28 to T27 will create a cycle and thus a deadlock state. Each transaction (T26, T27 and T28) will now be dependent each other because one transaction will have a lock on sources that will be needed by the next transaction and so on. Deadlocks should be prevented. Mechanisms should be put in place to detect deadlocks and to correct them as soon as

Open Document