SlideShare a Scribd company logo
1 of 24
Two concurrent bank transactions.
If there is inconsistency, money can appear or money can disappear.
Transactions are stated at the same time.
Transaction 1 (T1) reads the Account1 balance and takes a snapshot.
           The snapshot is now in the transaction scope.
Transaction 2 (T2) also reads the Account1 balance.
Each transaction now has its isolated snapshot of the Account1 balance.
T1 updates Account1 balance snapshot to 100-50=50
T2 also updates Account1 balance snapshot to 100-50=50
T1 reads the Account2 balance and takes a snapshot.
T2 also reads the Account2 balance and takes a snapshot.
Each transaction now has its isolated snapshot of the Account2 balance.
T1 updates Account2 balance snapshot to 0+50=50
T1 also updates Account2 balance snapshot to 0+50=50
T1 ends first and can commit the Account 1 balance new value.
Commit the Account2 balance.
The STM detects that T2 has reads and writes conflicts with the T1 already commited
                                      values.
Assuming that T2 does not have side effects, it can be executed again (retried).
On T2 retry, the T1 is already finished.
T2 reads the Account1 balance and takes a snapshot.
T2 updates its Account1 balance snapshot to 50-50=0
T2 reads the Account2 balance and takes a snapshot.
T2 updates its Account2 balance snapshot to 50+50=100
T2 commit Account1 balance.
T2 commit Account2 balance.
The two transactions end with success. Reads and writes were isolated and the STM
                detected the conflict, resolving it with the T2 retry.

More Related Content

Viewers also liked

Business Model Wargame, SunIdee 2012
Business Model Wargame, SunIdee 2012Business Model Wargame, SunIdee 2012
Business Model Wargame, SunIdee 2012
Martin Klitsie
 
Scenario design 2 11 14
Scenario design 2 11 14Scenario design 2 11 14
Scenario design 2 11 14
tjcarter
 

Viewers also liked (18)

Using Scenario Analysis to Predict the Future of the Semantic Web
Using Scenario Analysis to Predict the Future of the Semantic WebUsing Scenario Analysis to Predict the Future of the Semantic Web
Using Scenario Analysis to Predict the Future of the Semantic Web
 
Wargame Results for The Battle of Stocker's Ridge
Wargame Results for The Battle of Stocker's RidgeWargame Results for The Battle of Stocker's Ridge
Wargame Results for The Battle of Stocker's Ridge
 
Last Day
Last DayLast Day
Last Day
 
CDE Marketplace 2016: NSC
CDE Marketplace 2016: NSCCDE Marketplace 2016: NSC
CDE Marketplace 2016: NSC
 
Scenarios
ScenariosScenarios
Scenarios
 
WgSbD2
WgSbD2WgSbD2
WgSbD2
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids Workshop
 
War Games (Remote Control 2014, Utrecht)
War Games (Remote Control 2014, Utrecht)War Games (Remote Control 2014, Utrecht)
War Games (Remote Control 2014, Utrecht)
 
"The “inevitable future” scenario-building methodology" by Artiom Zheltov
"The “inevitable future” scenario-building methodology" by Artiom Zheltov"The “inevitable future” scenario-building methodology" by Artiom Zheltov
"The “inevitable future” scenario-building methodology" by Artiom Zheltov
 
Business Model Wargame, SunIdee 2012
Business Model Wargame, SunIdee 2012Business Model Wargame, SunIdee 2012
Business Model Wargame, SunIdee 2012
 
Scenario Analysis Use Case: 3G/4G Wireless Data
Scenario Analysis Use Case: 3G/4G Wireless DataScenario Analysis Use Case: 3G/4G Wireless Data
Scenario Analysis Use Case: 3G/4G Wireless Data
 
Beer Game - Silicon Valley Agile Leadership Network
Beer Game - Silicon Valley Agile Leadership NetworkBeer Game - Silicon Valley Agile Leadership Network
Beer Game - Silicon Valley Agile Leadership Network
 
Boardwargameschool v4.6
Boardwargameschool v4.6Boardwargameschool v4.6
Boardwargameschool v4.6
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO Workshop
 
YouMeO wargame
YouMeO wargameYouMeO wargame
YouMeO wargame
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
 
Scenario design 2 11 14
Scenario design 2 11 14Scenario design 2 11 14
Scenario design 2 11 14
 
Blue Ocean Beer Game
Blue Ocean Beer GameBlue Ocean Beer Game
Blue Ocean Beer Game
 

Activate STM example scenario