Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115.

Similar presentations


Presentation on theme: "Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115."— Presentation transcript:

1 Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115

2 Index Motivation B-Tree Protocol Why it works Example Precedence graph Proof

3 Motivation Data elements are not hierarchically stored by containment but rather they are DISJOINT. A B-TREE is the ideal data structure to represent such a database since traversal to reach any data element would require beginning at the root. Two-phase locking in such a situation makes concurrent use of DB by transactions impossible

4 B-TREE details Basic DS: - Keeps records in sorted order - Uses partially full blocks to speed up insertion and deletion Locking structure: - Granularity is at node level. Smaller is not beneficial and entire tree is infeasible!

5 Tree protocol Transaction’s first lock can be any node Subsequent locks only if currently locked parent Nodes unlocked any time Cannot relock if released node, even if parent is still held (As we can see – NOT 2PL)

6 Why it works Implies a serial order on transactions in schedule Define Ti < S Tj (order of precedence) In schedule S, Ti and Tj lock common nodes, but Ti locks first

7 Example Figure 18.30 from text book. And figure 18.31

8 Precedence graph Figure 18.32 from text book. T1 < S T2 T3 < S T2 Acyclic graph means any topological order is an equivalent serial schedule Thus, (T1, T3, T2) = (T3, T1, T2) This is because nodes are touched in same order.

9 Proof for acyclic precedence graph giving equivalent schedules If two transactions lock several elements in common, then they are all locked in the same order Figure 18.33


Download ppt "Database System Principles 18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115."

Similar presentations


Ads by Google