Download presentation
Presentation is loading. Please wait.
1
Prepared by: Mudra Patel (113) Locking Scheduler & Managing Hierarchies of Database Elements
2
Scheduler The order in which the individual steps of different transactions occur is regulated by the scheduler. The general process of assuring that transactions preserve consistency when executing simultaneously is called concurrency control.
3
Role of a Scheduler
4
Architecture of a Locking Scheduler The transactions themselves do not request locks, or cannot be relied upon to do so. It is the job of the scheduler to insert lock actions into the stream of reads, writes and other actions that access data. Transactions do not locks. Rather the scheduler releases the locks when the transaction manager tells it that the transaction will commit or abort.
5
Lock Table
6
The lock table is a relation that associates database elements with locking information about that element. The table is implemented with a hash table using database elements as a hash key.
7
Size of Lock Table The size of the table is proportional to the number of locked elements only and not to the entire size of the database since any element that is not locked does not appear in the table.
8
Structure of Lock Table Entries
9
Some Sort of information found in Lock Table entry 1>Group modes S: only shared locks are held X: one exclusive lock and no other locks U: one update lock and one or more shared locks
10
2>wait : one transaction waiting for a lock on A 3>A list : T currently hold locks on A or Waiting for lock on A
11
Handling Lock Requests Suppose transaction T requests a lock on A. If there is no lock-table entry for A, then surely there are no locks on A, so the entry is created and the request is granted. If the lock-table entry for A exists then we use it to guide the decision about the lock request.
12
Handling Unlocks If the value of waiting is ‘Yes’ then we need to grant one or more locks from the list of requested locks. The different approaches for this are: First-come-first-served Priority to shared locks Priority to upgrading
13
References BOOK: DATABASE SYSTEM THE COMPLETE BOOK THANK YOU!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.