{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

155 answer consider the tree structured database

Info iconThis preview shows pages 2–5. Sign up to view the full content.

View Full Document Right Arrow Icon
15.5 Answer: Consider the tree-structured database graph given below.
Background image of page 2

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Practice Exercises 3 a A a B a C Schedule possible under tree protocol but not under 2PL: T 1 T 2 lock (A) lock (B) unlock (A) lock (A) lock (C) unlock (B) lock (B) unlock (A) unlock (B) unlock (C) Schedule possible under 2PL but not under tree protocol: T 1 T 2 lock (A) lock (B) lock (C) unlock (B) unlock (A) unlock (C) 15.6 Answer: The proof is in Kedem and Silberschatz, Locking Protocols: From Exclu- sive to Shared Locks, JACM Vol. 30, 4, 1983. (The proof of serializability and deadlock freedom of the original tree protocol may be found in Sil- berschatz and Kedem, Consistency in Hierarchical Database Systems , JACM Vol. 27, 1, Jan 1980.) It is worth noting that if the protocol were modi±ed to allow update transactions to lock any data item ±rst, non-serializable executions can occur. Intuitively, a long running readonly transaction T 0 may precede an update transaction T 1 on node a , but continues to holds a lock on child node b . After T 1 updates a and commits, readonly transaction T 2 reads a , and thus T 1 precedes T 2 . However, T 2 now overtakes T 1 , share locking b and its child c (not possible with only exclusive locks), and reads c and
Background image of page 3
4 Chapter 15 Concurrency Control commits. Subsequently, transaction T 3 updates c and commits, after which T 0 share locks and reads c . Thus, there is a cycle T 0 T 1 T 2 T 3 T 0 In effect, two readonly transactionssee two different orderings ofthe same two update transactions. By requiring update transactions to always start at the root, the protocol ensures that the above situation cannot occur. In the above example T 3 would be forced to start from the root, and thus T 0 cannot be serialized after T 3 . The formal proof is by induction on the number of read-only transactions (and, we must admit, not very intuitive). We present it after introducing some notation Frst: Q X : the set of update transactions. Q S :the set of Read-only transactions. L ( T i ) : the set of data items locked by transaction T i Let Q the new protocol. Suppose T i and T k are update transactions, and T j a read only transaction; then if T j overlaps with T i and T k in the set of data items it accesses, since T i and T k both start from the root, T i and T k must also overlap on the set of data items accessed. ±ormally, T i Q X T j Q S T k Q X [(( L ( T i ) i L ( T j )) n= H ( L ( T j ) i L ( T k )) n= H ) ( L ( T i ) i L ( T k )) n= H ] Consider an arbitrary schedule of transactions in protocol Q . Let k be the number of Read-only transactions which participate in this schedule. We show by induction that there exist no minimal cycles in ( T , ), where T i T j denotes that T i precedes T j due to a con²ict on some data item. Let the cycle without loss of generality be,
Background image of page 4

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page2 / 11

155 Answer Consider the tree structured database graph...

This preview shows document pages 2 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online