# 15s - CHAPTER 15 Concurrency Control Practice Exercises...

This preview shows pages 1–4. Sign up to view the full content.

C H A P T E R 15 Concurrency Control Practice Exercises 15.1 Answer: Suppose two-phase locking does not ensure serializability. Then there exists a set of transactions T 0 , T 1 ... T n 1 which obey 2PL and which produce a nonserializable schedule. A non-serializable schedule implies a cycle in the precedence graph, and we shall show that 2PL cannot produce such cycles. Without loss of generality, assume the following cycle exists in the precedence graph: T 0 T 1 T 2 ... T n 1 T 0 . Let H9251 i be the time at which T i obtains its last lock (i.e. T i ’s lock point). Then for all transactions such that T i T j , H9251 i < H9251 j . Then for the cycle we have H9251 0 < H9251 1 < H9251 2 < ... < H9251 n 1 < H9251 0 Since H9251 0 < H9251 0 is a contradiction, no such cycle can exist. Hence 2PL cannot produce non-serializable schedules. Because of the property that for all transactions such that T i T j , H9251 i < H9251 j , the lock point ordering of the transactions is also a topological sort ordering of the precedence graph. Thus transactions can be serialized according to their lock points. 15.2 Answer: a. Lock and unlock instructions: T 34 : lock-S ( A ) read ( A ) lock-X ( B ) read ( B ) if A = 0 then B : = B + 1 write ( B ) unlock ( A ) unlock ( B ) 1

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

View Full Document
Practice Exercises 3 a99 A a99 B a99 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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern