Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Concurrency Control By Ankit Patel. 2 INTRODUCTION Enforcing serializability by locks Locks Locking scheduler Two phase locking Locking systems with.

Similar presentations


Presentation on theme: "1 Concurrency Control By Ankit Patel. 2 INTRODUCTION Enforcing serializability by locks Locks Locking scheduler Two phase locking Locking systems with."— Presentation transcript:

1 1 Concurrency Control By Ankit Patel

2 2 INTRODUCTION Enforcing serializability by locks Locks Locking scheduler Two phase locking Locking systems with several lock modes Shared and exclusive locks Compatibility matrices Upgrading/updating locks Incrementing locks

3 3 Locks It works like as follows : A request from transaction Scheduler checks in the lock table Generates a serializable schedule of actions.

4 4 Consistency of transactions Actions and locks must relate each other Transactions can only read & write only if has a lock and has not released the lock. Unlocking an element is compulsory. Legality of schedules No two transactions can aquire the lock on same element without the prior one releasing it.

5 5 Locking scheduler Grants lock requests only if it is in a legal schedule. Lock table stores the information about current locks on the elements.

6 6 The locking scheduler (contd.) A legal schedule of consistent transactions but unfortunately it is not a serializable.

7 7 Locking schedule (contd.) The locking scheduler delays requests that would result in an illegal schedule.

8 8 Two-phase locking Guarantees a legal schedule of consistent transactions is conflict-serializable. All lock requests proceed all unlock requests. The growing phase: Obtain all the locks and no unlocks allowed. The shrinking phase: Release all the locks and no locks allowed.

9 9 Working of Two-Phase locking Assures serializability. Two protocols for 2PL: Strict two phase locking : Transaction holds all its exclusive locks till commit / abort. Rigorous two phase locking : Transaction holds all locks till commit / abort. Possible to find a transaction Tj that has a 2PL and a schedule S for Ti ( non 2PL ) and Tj that is not conflict serializable.

10 10 Failure of 2PL. 2PL fails to provide security against deadlocks.

11 Refrences Database systems : The complete book Hector Garcia, Jeffrey Ullman, Jennifer Widom Topics 18.3, 18.4 11

12 ANY QUESTIONS ? 12

13 THANK YOU 13


Download ppt "1 Concurrency Control By Ankit Patel. 2 INTRODUCTION Enforcing serializability by locks Locks Locking scheduler Two phase locking Locking systems with."

Similar presentations


Ads by Google