1 / 10

Chapter 18.5: An Architecture for a Locking Scheduler

Chapter 18.5: An Architecture for a Locking Scheduler. Loc Nguyen Class ID: 213 Feb 27, 2008. Overview. 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. Lock table.

Download Presentation

Chapter 18.5: An Architecture for a Locking Scheduler

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 18.5: An Architecture for a Locking Scheduler Loc Nguyen Class ID: 213 Feb 27, 2008 Loc Nguyen

  2. Overview • 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 Loc Nguyen

  3. Lock table Two-part Scheduler transactions R(A); W(B); COMMIT(T); … Scheduler, Part I LOCK(A); R(A); … Scheduler, Part II R(A); W(B); … DB Loc Nguyen

  4. 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) Loc Nguyen

  5. 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 Loc Nguyen

  6. 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. Loc Nguyen

  7. A Tran Mode Wait Tnext Next B T1 S no U no T2 Group mode: U Waiting: yes X yes T3 List: <pointer> S no T1 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 Loc Nguyen

  8. A Tran Mode Wait Tnext Next B T1 S no U no T2 Group mode: U Waiting: yes X yes T3 List: <pointer> S no T1 Handling Lock Requests • SL1(A): • GM=S;W=N • UL2(A): • GM=U;W=N • XL3(A): • GM=U;W=Y Loc Nguyen

  9. A Tran Mode Wait Tnext Next B T1 S no U no T2 Group mode: U Waiting: yes X yes T3 List: <pointer> S no T1 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” • 1st come 1st serve • Prio. shared locks • Prio. upgrading Loc Nguyen

  10. Q & A • Thank you! Loc Nguyen

More Related