Schedules Schedules- sequences that indicate the chronological order in Which instructions of concurrent transactions are executed *r a schedule for a set of transactions must consist of all instructions of those transactions t must preserve the order in which the instructions appear in each individual transaction 标 Database System Concepts 15.11 @Silberschatz, Korth and Sudarshan
Database System Concepts 15.11 ©Silberschatz, Korth and Sudarshan Schedules Schedules – sequences that indicate the chronological order in which instructions of concurrent transactions are executed a schedule for a set of transactions must consist of all instructions of those transactions must preserve the order in which the instructions appear in each individual transaction
Example schedules Let T1 transfer $50 from A to B, and T2 transfer 10%of the balance from a to B. The following is a serial schedule(schedule 1 in the text), in which T1 is followed by T: 12 read(A) A:=A-50 write(A) read(B) B:=B+5 rite (B) read(A) temp: =A*0.1 A: =A-temp write (A) read(B) B: =B+temp write(B) Database System Concepts 15.12 @Silberschatz, Korth and Sudarshan
Database System Concepts 15.12 ©Silberschatz, Korth and Sudarshan Example Schedules Let T1 transfer $50 from A to B, and T2 transfer 10% of the balance from A to B. The following is a serial schedule (Schedule 1 in the text), in which T1 is followed by T2
Example Schedule(Cont) Let T1 and T2 be the transactions defined previously. The following schedule(Schedule 3 in the text)is not a serial schedule, but it is equivalent to Schedule 1 T T read(A) A:=A-50 write(A) read(A) emp:=A*0.1 A: =A-temp write(A) read(B) B:=B+50 write (B) read(B) B: =B+ temp write (B) In both Schedule 1 and 3, the sum A+ B is preserved Database System Concepts 15.13 @Silberschatz, Korth and Sudarshan
Database System Concepts 15.13 ©Silberschatz, Korth and Sudarshan Example Schedule (Cont.) Let T1 and T2 be the transactions defined previously. The following schedule (Schedule 3 in the text) is not a serial schedule, but it is equivalent to Schedule 1. In both Schedule 1 and 3, the sum A + B is preserved
Example Schedules(Cont.) The following concurrent schedule schedule 4 in the text)does not preserve the value of thethe sum A+ B T read(A) A:=A-50 read(A) temp: =A*0.1 A: =A-temp write (A) read(B) write(A) read(B) B:=B+50 write(B B: =B+ temp write(B) Database System Concepts 15.14 @Silberschatz, Korth and Sudarshan
Database System Concepts 15.14 ©Silberschatz, Korth and Sudarshan Example Schedules (Cont.) The following concurrent schedule (Schedule 4 in the text) does not preserve the value of the the sum A + B