Chapter 2 Transaction Management
Chapter 2 Transaction Management
Chapter 2
Transaction Processing Concepts
Sirage Z.
Department of Computer Science
Debre Berhan University
2022
What is a transaction?
A Transaction is a mechanism for applying the desired
modifications/operations to a database.
Action, or series of actions, carried out by a single user or
application program, which accesses or changes contents of
database. (i.e. Logical unit of work on the database.)
A transaction could be a whole program, part/module of a
program or a single command.
Changes made in real time to a database are called transactions.
Examples include ATM transactions, credit card approvals, flight
reservations, hotel check-in, phone calls, supermarket canning,
academic registration and billing.
06/03/2025 Transactions processing and concurrency Management 2
…Con’t
A transaction could be composed of one or more
database and non-database operations.
Transforms database from one consistent state to
another, although consistency may be violated during
transaction.
A database transaction is a unit of interaction with
database management system or similar system that
is treated in a coherent and reliable way independent
of other transactions.
06/03/2025 Transactions processing and concurrency Management 3
Transaction Processing System
A system that manages transactions and controls their access to a DBMS
is called a TP monitor.
A transaction processing system (TPS) generally consists of a TP monitor,
one or more DBMSs, and a set of application programs containing
transaction.
In database field, a transaction is a group of logical operations that must
all succeed or fail as a group.
Systems dedicated to supporting such operations are known as
transaction processing systems.
of the DBMS
Fig. the transaction sub system
Notations:
> Read(x) read data item x from database
> Write(x) write data item x into the database
Thus in serial execution of transaction, if we have two transactions T i and Ti+1, then Ti+1 will only be executed
after the completion of Ti.
06/03/2025 Transactions processing and concurrency Management 20
…con’t
(b) Concurrently: is the reverse of serially executable transactions,
In this scheme the individual operations of transactions, i.e., reads and writes are interleaved in some
order.
Time T1 T2
read (X) {X = 10}
read (X) {X = 10}
X := X+N {X = 11}
X := X+N {X = 11}
write (X) {X = 11}
write (X) (X=11)
read (Y) {Y = 6}
Y := Y+N {Y = 7}
write (Y) {Y = 7}
Figure 2.7 Constructing the precedence graphs for schedules A to D from Figure 20.5 to
test for conflict serializability (a) Precedence graph for serial schedule A (b) Precedence
graph for serial schedule B (c) Precedence graph for schedule C (not serializable) (d)
Precedence graph for schedule D (serializable, equivalent to schedule A)
Exercise
Ex1:
R1(x) W2(x) W1(x)
Check: T1T2 and T2T1
Ex2:
R1(x)W2(x)W1(x)W3(x)
Check: T1T2, T2T1, T2T3, T3T2, T1T3, and T3T1