Tuesday, 11 February 2014

Scheduling of transaction | Transaction Management


SCHEDULING OF TRANSACTIONS
Scheduling of transaction represents the actual execution sequence. A schedule of a system is an abstract model to describe execution of transactions running in the system. A Schedule is a list of actions (reading, writing, aborting or committing) from a set of transaction must consist of all instructions of those transactions and must preserve the order in which the transaction appear in each individual transaction.

For Example- If in a transaction T1 the instruction write(A) appears before read(A) then in any valid schedule this sequence must also be preserved.

Let's discuss various types of scheduling-

 1. Complete Schedule- A  Schedule that contains either an abort or a commit for each transaction whose actions are listed in it is called a complete schedule. In simple words we can say after each transaction there is commit or abort command.A complete schedule must contain all the actions of every transaction that appears in it.

2. Serial Schedule- Serial Schedule is the schedule in which after completion of one transaction second take place.For Example- There are 2 transactions T1 and T2. 

                          T1                  T2

                          A=A+100
                          B=B-100
                                               A=A*7.06
                                               B=B*7.06
                                    (Schedule 1)
When T1 transaction completes its execution after that transaction T2 takes place.This is called Serial Schedule.

3. Non Serial Schedule- A Schedule in which the operations from a set of concurrent transaction are interleaved is called a non-serial Schedule.For Example- There are 2 transactions T1 and T2 and transaction takes place concurrently.This is called Non-serial transaction.

                          T1                      T2

                          A=A+100
                                                    A=A*7.06
                          B=B-100
                                                    B=B*7.06
                                    (Schedule 2)
                        
4. Equivalent Schedule- The effect of executing the first schedule is identical to the effect of executing the second schedule. For Example- (Schedule 2) is equivalent to (Schedule 1).

5. Serializiable schedule- A non-serial schedule is said to be serializiable if it produces the same result as that of some serial execution of  transaction running concurrently without interfering with each other.For Example- Output of (Schedule 1=400) and (Schedule 2=400) then it is called serializiable. In serializability the ordering of read and writes operations are important.                          


0 comments:

Post a Comment