Transaction Isolation(3)
Refer to the previous parts for the initial example
Example-1: Create a Schedule-3 such that it is : < T11, T21, T12, T22 >
Where, T11 : first 3 statements of T1.
T12 : last 4 statements of T1.
T21 : first 4 statements of T2.
T22 : last 4 statements of T2.
T1 | T2 |
read A ; A = A – 50 ; write A ; | |
read A ; temp = A * 0.1 A = A – temp ; write A ; | |
read B ; B = B + 50 ; write B ; commit | |
read B ; B = B + temp ; write B ; commit |
What are the values of A and B after Schedule-3 ?
Here, the values of A and B initially are : 1000 and 2000.
T1 | T2 | |||
A | B | A | B | |
Initial Values | 1000 | 2000 | 1000 | 2000 |
After T11 | 950 | 2000 | —– | —– |
After T21 | —– | —– | 900 | 2000 |
After T12 | 950 | 2050 | —– | —– |
After T22 | —– | —– | 900 | 2100 |
Here, the value of temp = 100.
Also, before and after Schedule-1, A + B values are the same.
Reference Links