Download presentation
Presentation is loading. Please wait.
1
02/27/2008Loc Nguyen1 Chapter 18.5: An Architecture for a Locking Scheduler Loc Nguyen Class ID: 213 Feb 27, 2008
2
02/27/2008Loc Nguyen2 Assume knowledge of: Lock Two phase lock Lock modes: shared, exclusive, update Consider a simple scheduler that: Insert locks for transaction Release locks when told Overview
3
02/27/2008Loc Nguyen3 Two-part Scheduler Scheduler, Part I Scheduler, Part II DB Lock table transactions R(A); W(B); COMMIT(T); … LOCK(A); R(A); … R(A); W(B); …
4
02/27/2008Loc Nguyen4 Semantics of Two-part Scheduler Part I: select & insert appropriate lock modes to db operations (read,write, or update) Part II: take actions (a lock or db operation) from Part I Determine the transaction (T) that action belongs and status of T (delayed or not)
5
02/27/2008Loc Nguyen5 Semantics (Cont’d) If T is delayed, action is delayed and added to wait list If not, Action is db operation, to be executed Is lock, check lock table Granted, update lock table w. granted entry Else, update lock table w. lock request; delay further actions for T until lock granted
6
02/27/2008Loc Nguyen6 Semantics (Cont’d) When T is done (commits or aborts), transaction manager (belongs to T) notify Part I to release all locks, if exists waiting lock, Part I notifies Part II Part II when notified, determines next transaction T’ to get lock to continue.
7
02/27/2008Loc Nguyen7 The Lock Table Group modes: - S: only shared locks - U: one update lock and zero or shared locks - X: one exclusive lock and no other locks A Uno T2 X yes T3 Sno T1 Tran Mode Wait Tnext Next Sno T1 B Group mode: U Waiting: yes List:
8
02/27/2008Loc Nguyen8 Handling Lock Requests A Uno T2 X yes T3 Sno T1 Tran Mode Wait Tnext Next Sno T1 B Group mode: U Waiting: yes List: SL1(A): GM=S;W=N UL2(A): GM=U;W=N XL3(A): GM=U;W=Y
9
02/27/2008Loc Nguyen9 Handling Unlock Requests Remove entry Update group mode Same as group mode, no action Diff; then check entire list for new group mode S: GM(S) or nothing U: GM(S) or nothing X: nothing Update wait if “yes” 1 st come 1 st serve Prio. shared locks Prio. upgrading A Uno T2 X yes T3 Sno T1 Tran Mode Wait Tnext Next Sno T1 B Group mode: U Waiting: yes List:
10
02/27/2008Loc Nguyen10 Q & A Thank you!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.