Professional Documents
Culture Documents
TRANSACTIONS
The transaction consists of all operations executed between the begin transaction
and end transaction.
To ensure integrity of the data, we require that the database system maintain the
following properties of the transactions.
Atomicity: Either all operations of the transaction are related properly in the
database, or none are.
Partially Committe
Committed d
Active
Failed Aborted
Shadow copy scheme: Shadow copy scheme is based on making copies of the
database called shadow copies, assumes that only one transaction is active at a time.
The scheme also assumes that the database is simply a file on disk. A pointer called
db-pointer is maintained on disk; it points to the current copy of the database.
T1 T1 T2
T2 Read(A)
Read(A) Temp:=A* 0.1
A:=A-50 A:=A-temp
Write (A) Write(A)
Read(B) Read(B)
B:=B+50 B:=B+ temp
Write(B) Write(B)
Read(A) Read(A)
Temp:=A* 0.1 A:=A-50
A:=A-temp Write (A)
Write(A) Read(B)
Read(B) B:=B+50
B:=B+ temp Write(B)
Write(B)
Schedule1: A serial schedule in which T1 Schedule2: A serial schedule in which T2
is followed by T2. is followed by T1.
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)
Read(B)
B:=B+ temp
Write(B)
T3 T4
Read(Q)
Write(Q)
Write(Q)
Schedule 4
Schedule4 consist of only the significant operations (that is, the read and write) of
transactions T3 and T4. This schedule is not conflict serializable, since it is not
equivalent to either the serial schedule < T3, T4> or the serial schedule < T4, T3>. It
is possible to have two schedules that produce the same outcome, but that are not
conflict equivalent.
T8 T9
Read(A)
Write(A)
Read(A)
Read(B)
Schedule 7
Schedule 7, with the commit happening immediately after the read (A) instruction,
is an example of a non-recoverable schedule, which should not be allowed.
T1 T2 T1 T2
Read(A)
Read(A) Write(A)
Write(A) Read(B)
T T T T
Read(B) Write(B)
Write(B) Read(A) 1 2
Read(A) 2 1
Write(A) Write(A)
Read(B) Read(B)
Write(B) Write(B)
T1 T2
Read(A)
Read(A)
Write(A)
Read(B) T T
Write(A)
1 2
Read(B)
Write(B)
Write(B)
Ti
Tj Tk
Tm
Ti Ti
Tj Tk
Tk Tj
Tm Tm