VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
1. VALIDATION BASED PROTOCOL AND MULTIPLE
GRANULARITY
VALIDATION BASED PROTOCOL
PRESENTED BY: KASHISH HORA
SAMYAK JAIN
submitted to ā Anju Sharma Mam
2. INTRODUCTION
ļµ Validation Based Protocol is also called Optimistic Concurrency Control Technique. This protocol is used in
DBMS (Database Management System) for avoiding concurrency in transactions.
ļµ It is called optimistic because of the assumption it makes, i.e. very less interference occurs, therefore,
there is no need for checking while the transaction is executed.
ļµ In this technique, no checking is done while the transaction is been executed. Until the transaction end is
reached updates in the transaction are not applied directly to the database. All updates are applied to local
copies of data items kept for the transaction.
ļµ At the end of transaction execution, while execution of the transaction, a validation phase checks whether
any of transaction updates violate serializability. If there is no violation of serializability the transaction is
committed and the database is updated; or else, the transaction is updated and then restarted.
ļµ Optimistic Concurrency Control is a three-phase protocol. The three phases for validation based protocol:
3. ā¢READ PHASE:- In this phase Ti reads all data & store them in temporary variables(local
variables of Ti)
After reading all the write operations are made on temporary variables instead of
actual Database.
ā¢VALIDATION PHASE:-In this validation test is performed to determine whether changes
in actual
database can be made.
ā¢WRITE PHASE:- If Ti clear the validation test then actual changes are made to
database.
Validation test ensures the violation free execution of transaction.
ā¢Timestamp is used to determine when to start validation test.
ā¢Every Ti is associated with three timestamp which are:-
1.Start(Ti):- It gives time when it start execution.
2.Validation(Ti):- It gives time when Ti finishes its read phase & starts its validation
phase.
3. Finish(Ti):- It gives time when Ti finished its execution or write phase.
ā¢ If any transaction failed in validation test then its aborted & rollback.
4. VALIDATION TEST:-
To clear all the validation test by Ti then Ti must satisfy one of the following
condition:-
ā¢ Finish(Ti)<Start(Ti):- It means Ti is older transaction and it get enabled before Tj
starts.
ā¢ Finish(Ti)<Validate(Tj):- this ensures actual write by Ti & Tj will not overlap.
ā¢ Validate(Ti)< Validate(Tj):- It ensures that Ti has completed read phase before Tj
complete read phase.
Example:-
5. Advantages:-
1. Avoid Cascading-rollbacks: This validation based scheme avoid cascading rollbacks since
the final write operations to the database are performed only after the transaction passes the
validation phase. If the transaction fails then no updation operation is performed in the database
So no dirty read will happen hence possibilities cascading-rollback would be null.
2. Avoid deadlock: Since a strict time-stamping based technique is used to maintain the specific
the specific order of transactions. Hence deadlock isnāt possible in this scheme.
Disadvantages:
1. Starvation: There might be a possibility of starvation for long-term transactions, due
to a sequence of conļ¬icting short-term transactions that cause the repeated sequence
of restarts of the long-term transactions so on and so forth. To avoid starvation ,
conļ¬icting transactions must be temporarily blocked for some time, to let the
long-term transactions to ļ¬nish.
6. Multiple Granularity
It is the size of data item allowed to lock and define a
hierarchy of data granularities , where the small
granularities are nested within larger ones.
Fine Granularity- refers to small data item size.
example - a tuple or an attribute.
Course Granularity- refers to large data item size
example - entire relation or a database.
7. The hereachy of data item of various size can be
represented in the form of a tree
Fig: Granularity Hierarchy
8. When a transaction locks a node in the tree explicitly , it implicitly locks all the
node descendants in the same mode.
ā¢ Tj must traverse from the root of the tree to record ra1 to check whether this
request can be granted.
ā¢ If any node in that path is locked in incompatiable mode then the lock request
can not be granted.
9. Intention Lock Modes
ļµ In addition to S and X lock modes, there are three additional lock modes with multiple granularity:
1. Intention shared(IS): indicates explicit locking at a lower level of tree but only with shared locks.
2. Intention exclusive(IX): indicates explicit locking at a lower level with exclusive or shared locks.
3. Shared and Intention exclusive(SIX): the subtree rooted by that node is locked explicitly in shared mode and explicit
locking is being done at a lower level with exclusive mode locks.
ļ intention locks allow a higher level node to be locked in S or X mode without having to check all descendent
nodes.