Schedules Schedule-a sequences of instructions that specify 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. A transaction that successfully completes its execution will have a commit instructions as the last statement(will be omitted if it is obvious) A transaction that fails to successfully complete its execution will have an abort instructions as the last statement(will be omitted if it is obvious) Database System Concepts-5th Edition,Sep 10,2005. 15.12 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 15.12 ©Silberschatz, Korth and Sudarshan th Edition, Sep 10, 2005. Schedules Schedule – a sequences of instructions that specify 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. A transaction that successfully completes its execution will have a commit instructions as the last statement (will be omitted if it is obvious) A transaction that fails to successfully complete its execution will have an abort instructions as the last statement (will be omitted if it is obvious)
Schedule 1 Let T1 transfer $50 from A to B,and T2 transfer 10%of the balance from A to B. A serial schedule in which T1 is followed by T2: Ti T2 read(A) A:=A-50 write (A) read(B) B:=B+50 write(B) read(A) temp:=A *0.1 A:=A-temp write(A) read(B) B:=B temp write(B) Database System Concepts-5th Edition,Sep 10,2005. 15.13 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 15.13 ©Silberschatz, Korth and Sudarshan th Edition, Sep 10, 2005. Schedule 1 Let T1 transfer $50 from A to B, and T2 transfer 10% of the balance from A to B. A serial schedule in which T1 is followed by T2 :
Schedule 2 A serial schedule where T2 is followed by T1 T T2 read(A) temp :=A*0.1 A:=A-temp write(A) read(B) B:=B+temp write(B) read(A) A:=A-50 write(A) read(B) B:=B+50 write(B) Database System Concepts-5th Edition,Sep 10,2005. 15.14 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 15.14 ©Silberschatz, Korth and Sudarshan th Edition, Sep 10, 2005. Schedule 2 • A serial schedule where T2 is followed by T1
Schedule 3 Let T1 and T2 be the transactions defined previously.The following schedule is not a serial schedule,but it is equivalent to Schedule 1. T 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) In Schedules 1,2 and 3,the sum A+B is preserved. Database System Concepts-5th Edition,Sep 10,2005. 15.15 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 15.15 ©Silberschatz, Korth and Sudarshan th Edition, Sep 10, 2005. Schedule 3 Let T1 and T2 be the transactions defined previously. The following schedule is not a serial schedule, but it is equivalent to Schedule 1. In Schedules 1, 2 and 3, the sum A + B is preserved
Schedule 4 The following concurrent schedule does not preserve the value of (A+B). T T2 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-5th Edition,Sep 10,2005. 15.16 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 15.16 ©Silberschatz, Korth and Sudarshan th Edition, Sep 10, 2005. Schedule 4 The following concurrent schedule does not preserve the value of (A + B)