Monday, 17 February 2014

Concurrency Control algorithm in transaction management |Database management system


CONCURRENT CONTROL ALGORITHMS-
There are two approaches used in algorithms to deals with the problems of concurrency control.These are:-

1.) Pessimistic Approach
2.) Optimistic Approach

1.) PESSIMISTIC APPROACH- This approach causes transaction to be delayed in case they conflict with each other at the some time in future.

PESSIMISTIC EXECUTION- The validate operation is performed first,if there is a validation according to compatibility  of lock then only read,compute and write operation are performed.

                           VALIDATE | READ | COMPUTE | WRITE

There are two commonly used algorithms,which are based on pessimistic approach:
a.) Two phase locking protocol
b.) Time stamp ordering protocol

2.) OPTIMISTIC APPROACH- The optimistic method of concurrency control is based on the  assumption that conflicts of database operations are rare and that it is better to let transaction run to completion and only check for conflicts before they commit.An optimistic concurrency control method is also known as validation or certification methods.The Optimistic method does not require locking or time stamping techniques.Instead,a transaction is executed without restrictions until it is committed.It allows transactions to proceed unsynchronized and check conflicts at the end.This approach is based on the premise that conflicts are rare.

OPTIMISTIC EXECUTION- It perform read and compute operation without validation and perform validation just before write operation.

                           READ | COMPOSITE | VALIDATE | WRITE 

ADVANTAGES OF OPTIMISTIC METHODS FOR CONCURRENCY CONTROL:-


1.) This technique is very efficient when conflicts are rare. The occasional conflicts result in the transaction rollback.
2.) The roolback involves only the local copy of data, the database is not involved and thus there will not be any cascading rollbacks.

PROBLEMS OF OPTIMISTIC METHODS FOR CONCURRENCY CONTROL:

1.) Conflicts are expensive to deal with, since the conflicting transaction must be rolled back.
2.) Longer transactions are more likely to have conflicts and may be repeatedly rolled back because of conflicts with short transactions.

APPLICATIONS OF OPTIMISTIC METHODS FOR CONCURRENCY CONTROL:

1.) Only suitable for environment where there are few conflicts and no long transactions.
2.) Acceptable for mostly Read and Query database systems that requires very few update.

0 comments:

Post a Comment