+ All Categories
Home > Documents > Prepared by: Mudra Patel (113) Locking Scheduler & Managing Hierarchies of Database Elements.

Prepared by: Mudra Patel (113) Locking Scheduler & Managing Hierarchies of Database Elements.

Date post: 19-Dec-2015
Category:
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
13
Prepared by: Mudra Patel (113) Locking Scheduler & Managing Hierarchies of Database Elements
Transcript

Prepared by: Mudra Patel (113)

Locking Scheduler&

Managing Hierarchies of Database Elements

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.

Role of a Scheduler

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.

Lock Table

Lock Table 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.

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.

Structure of Lock Table Entries

Some Sort of information found in Lock Table entry

1>Group modesS: only shared locks are heldX: one exclusive lock and no

other locks U: one update lock and one or

more shared locks

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

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.

Handling UnlocksIf 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-servedPriority to shared locksPriority to upgrading

References

BOOK: DATABASE SYSTEM THE COMPLETE BOOK

THANK YOU!


Recommended