Вы находитесь на странице: 1из 6

Concurrency Problems in Transaction

Several problems can occur when concurrent transactions execute in an uncontrolled manner.
Some Concurrency Problems in transaction are :

The Lost Update Problem

The uncommitted dependency problem/The Temporary Update (or Dirty


Read) Problem

The inconsistent analysis problem/The Incorrect Summary Problem

The Unrepeatable Read Problem

The Lost update problem


Consider the following example :

In this example

Transaction A retrieves some tuple X at time T1.

Transaction B retrieves same tuple X at time T2.

Transaction A update the tuple X at time T3.

Transaction B update the same tuple at time T4 on the base of the values
available at time T2.

Transaction As update is lost at time T4, since transaction B overwrites it.

The uncommitted dependency problem


Consider the following example :

In this example

Transaction B update the tuple at time T1.

Transaction A retrieves the same tuple X and use the updated results at time
T2.

Update (made by transaction be at time T1) is then update at time T3.

The inconsistent analysis problem


Consider the following example :

In this example, transaction A is used to find the sum of account balances and transaction B is
used to transfer an amount 20 from account 2 to account 1.

At time T1, transaction A retrives AC 1 and some becomes 50.

Transaction B retrives AC 2 at time T2. And update it at time T3 as a result


balance of AC 2 becomes 90.

Transaction retrives AC 1 at time T4 and update balance of AC 1 becomes 70.

Transaction B commits at time T6.

At time T7, transaction A retrieve AC 2 and sum becomes 140 but not 160.
The result produced by A is wrong. Hence we say that transaction A has seen
an inconsistent state.

The Unrepeatable Read Problem


Another problem that may occur is called unrepeatable read, where a transaction T reads the
same item twice and the item is changed by another transaction T between the two reads.
Hence, T receives different values for its two reads of the same item.

Another Example : Describing all the Concurrency Problems


(Including Phantom Row and Unstable Errors) :

Phantom Row and Unstable Errors : Concurrency Problems in


Transaction

Вам также может понравиться