lec23 - Locking Protocols Chapter 17 4/4/11 EECS 484:...

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

View Full Document Right Arrow Icon
1 4/4/11 EECS 484: Database Management Systems, Kristen LeFevre 1 Locking Protocols Chapter 17 4/4/11 EECS 484: Database Management Systems, Kristen LeFevre 2 Agenda Last time: transactions, schedules, lock basics How can we use locking to guarantee schedules with desirable properties? Serializable Recoverable Avoid cascading aborts (ACA) Deadlock Definition, detection, and prevention
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 4/4/11 EECS 484: Database Management Systems, Kristen LeFevre 3 Basic Locking Protocol If transaction T wants to use data object O, it must request a lock on O To read O: Request a shared (S) lock To write O: Request an exclusive (X) lock If another transaction holds an incompatible lock on O, then T must wait until that lock is released Bookkeeping and wait queues implemented by lock manager Key Question: When to release locks? 4/4/11 EECS 484: Database Management Systems, Kristen LeFevre 4 When to Release Locks? Goal: Guarantee transaction serializability (+ recoverability, ACA) Naïve Protocol: Transaction T releases its lock on O immediately after it is done reading / writing O. Does not guarantee serializability!
Background image of page 2
3 4/4/11 EECS 484: Database Management Systems, Kristen LeFevre 5 Example commit W(A) begin T2: Add 10% T1: Transfer $100 from A to B commit R(A) /A *= 1.1 begin W(B) R(B) /B += 100 W(B) R(B) /B *= 1.1 W(A) R(A) /A -= 100 Acquire S lock on A Acquire X lock on A Release lock on A Acquire S lock on A Acquire X lock on A Release lock on A Acquire S lock on B Acquire X lock on B Release lock on B Acquire S lock on B Acquire X lock on B Release lock on B Recall the example schedule From last time that was not serializable
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

lec23 - Locking Protocols Chapter 17 4/4/11 EECS 484:...

This preview shows document pages 1 - 4. Sign up to view the full document.

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