TMF Introduction (G06.24+)

TMF Overview
HP NonStop Transaction Management Facility (TMF) Introduction522414-001
1-6
Transaction Concurrency
Transaction Concurrency
To process the transaction correctly, an application program must have consistent input
from the database, regardless of any concurrent changes being made to the database.
To illustrate the problems introduced when there is no protection for concurrency,
assume two concurrent transactions each check the balance of an account and then
deposit funds to the account (see Figure 1-4). Transaction T1 queries the balance,
which is $50, and then deposits $500 to the account. Another concurrent transaction,
T2, queries the account balance, determines the balance is $50, and deposits $100 to
the balance. These concurrent transactions demonstrate the problem when the $500
transferred by T1 is lost.
Both transactions T1 and T2 retrieve the balance information of $50. Then, because of
a lack of concurrency control, T1 is overwritten by T2. This is just one of the problems
in managing concurrent transactions.
Figure 1-4. Lack of Concurrency Control
BEGIN T1
Get current balance ($50)
Deposit $500
NEWBAL=$50+$500
Writes NEWBAL of $550
END T1
Balance
$50
$550
$150
CHECKING
BEGIN T2
Get current balance ($50)
Deposit $100
NEWBAL=$50 +$100
Writes NEWBAL of $150
END T2
ERROR
VST004.vsd