Questions on Timestamp Ordering Question 1 : Which of the following TS order allow to execute the above schedule using BTSO (Basic Timestamp Ordering) Protocol ? R1(A); R2(B); W1(C); R3(B); R3(C); W2(B); W3(A) a) (T1,T2,T3) = (10,20,30) b) (T1,T2,T3) = (30,10,20) c) (T1,T2,T3) = (30,20,10) d) (T1,T2,T3) = (20,30,10) e) (T1,T2,T3) = (10,30,20) Solution :…

Serializability in Database A schedule S of n transactions is serializable if it is equivalent to some serial schedule of the ‘n’ transactions. Every serializable schedule is consistent i.e. it is not suffering from RW, WR, WW etc. The concept of serializability of schedules is used to identify which schedules are correct when transaction executions have interleaving of…

Multiple Granularity Locking Protocol Before defining Multiple Granularity – let us define what is Granularity ? Granularity is the size of data item  allowed to lock. Multiple Granularity is the hierarchically  breaking up the database into portions which are lockable and maintaining the track of what to be lock and how much to be lock…

Thomas write rule Thomas write rule modify or improves the Basic Timestamp Ordering Algorithm (BTSO Algorithm). According to Basic Timestamp Ordering Algorithm (BTSO Algorithm) : When Transaction Ti issues READ Operation : If TS(Ti) < WTS(Q), then ROLLBACK Ti. RESTART Ti Otherwise, allowed to execute READ operation by transaction Ti and Set RTS(Q) = max(RTS(Q), TS(Ti))…

Timestamp Ordering Protocols In timestamp based protocols, the system itself tries to detect possible inconsistency during concurrent execution and recovers from it or avoids it. In it, for every transaction the system executes, the system gives the timestamp to that transaction i.e. it provides a set of timestamps to every transaction Ti by unique timestamp( any integer…

Starvation in Deadlock (Livelock) What is Starvation? The indefinite waiting of a transaction is called as starvation. When does Starvation Occurs? Starvation occurs when a transaction cannot proceed for an indefinite period of time while other transactions in the system continue normally. Example : Suppose 2 transactions T1 and T2 are trying to acquire a lock…

Deadlock in Transaction What is Deadlock and How the Deadlock is occurred? Deadlock occurs when each transaction T in a set of 2 or more transactions is waiting for some item that is locked by some other transaction T’ in the set. Hence, each transaction in the set is on a waiting queue, waiting for…

2 Phase Locking Need of 2 Phase Locking Binary locks or shared and exclusive locks in transaction does not guarantee serializability of schedules on its own. For example, consider a banking transaction where the read write locking rules are used, but we get a non serializable schedule which give incorrect result. To ensure the serializability, we…