(Press ?
for help, n
and p
for next and previous slide)
Christopher Olbrich (License Information)
A DBMS gives access to the data within a database
DBMS by Christopher Olbrich under CC BY-SA 4.0; from GitLab
Banking is frequently used to explain the need for transaction processing
Id | Name | Balance |
---|---|---|
1 2 3 |
Alice Bob Eve |
100 200 50 |
Time | Transaction T1 |
---|---|
1 2 3 4 5 |
begin read(Balance of Alice) Balance = Balance + 100 write(Balance of Alice) commit |
Time | Transaction T1 | Transaction T2 |
---|---|---|
1 2 3 |
begin read(Balance of Alice) Balance = Balance - 10 |
|
4 5 6 |
|
begin read(Balance of Alice) Balance = Balance + 100 |
7 8 |
write(Balance of Alice) read(Balance of Bob) |
|
9 10 |
|
write(Balance of Alice) commit |
11 12 13 |
Time | Transaction T1 | Transaction T2 |
---|---|---|
1 2 3 4 |
begin read(Balance of Alice) Balance = Balance - 10 write(Balance of Alice) |
|
5 6 7 8 9 |
|
begin read(Balance of Alice) Balance = Balance + 100 write(Balance of Alice) commit |
10 | failure & aborted |
Balance of Bob = 200
Time | Transaction T1 | Transaction T2 |
---|---|---|
1 2 3 |
begin read(Balance of Bob) Balance = Balance - 30 |
|
4 5 6 |
|
begin read(Balance of Bob) Balance = Balance + 40 |
7 8 |
write(Balance of Bob) read(Balance of Eve) |
|
9 10 |
... |
write(Balance of Bob) ... |
After Edgar F. Codd published his influential paper about the relational model for database systems in 1969, the first practical systems based on this model were implemented
Jim Gray speeking (editet) by Tony Hey, Stewart Tansley, Kristin Tolle (Eds.) under CC BY-SA 3.0; from Wikimedia
Time | A simple transaction |
---|---|
1 2 4 5 |
begin read(X) write(Y) commit |
The 2PL is the most famous locking protocol, used in many commercial database systems. [WV01]
Lock aquiring and release under 2PL by Christopher Olbrich under CC BY-SA 4.0; from GitLab
Time | Transaction T1 | Transaction T2 |
---|---|---|
1 2 |
begin writelock(Balance of Alice) |
|
3 4 |
|
begin writelock(Balance of Bob) |
5 6 7 |
read(Balance of Alice) Balance = Balance - 10 write(Balance of Alice) |
|
8 9 10 |
|
read(Balance of Bob) Balance = Balance - 5 write(Balance of Bob) |
11 | writelock(Balance of Bob) | |
12 | writelock(Balance of Alice) |
Deadlock: T1 waiting for a lock held by T2 and vice versa
The Conservative 2PL (preclaiming) is a variant of the 2PL which addresses the problem of deadlocks
Lock aquiring and release under conservative 2PL by Christopher Olbrich under CC BY-SA 4.0; from GitLab
Except where otherwise noted, this work, “Introduction to transaction processing”, is © 2018 by Christopher Olbrich, published under the Creative Commons license CC BY-SA 4.0.
In particular, trademark rights are not licensed under this license. Thus, rights concerning third party logos (e.g., on the title slide) and other (trade-) marks (e.g., “Creative Commons” itself) remain with their respective holders.