0
820views
Explain optimistic concurrency control technique.
1 Answer
0
17views

Concurrency control

  • Concurrency controlling techniques ensure that multiple transactions are executed simultaneously while maintaining the ACID properties of the transactions.

  • Simultaneous execution of transactions overashared database can create several data integrity and consistency problems.

    • Lost Update
    • Dirty Read Problems
    • Incorrect Summary Problems
    • Unrepeatable Read Problem

Optimistic concurrency control

  • Optimistic concurrency control isaconcurrency control method applied to transactional systems

    • The transaction is executed without restriction and before committing, each transaction verifies that no other transaction has R/W conflicts.
    • If the check reveals conflicting modifications, the committing transaction rolls back and can be restarted.
  • In optimistic methods, each transaction moves through the following phases:

    • Read phase.
    • Validation or certification phase.
    • Write phase.
  • Read phase:

    • The transaction reads the database, executes the needed computations and makes the updates toaprivate copy of the database values.
    • All update operations of the transactions are recorded ina temporary update file, which is not accessed by the remaining transactions.
  • Validation phase:

    • The transaction is validated to establish whether or not its operations on objects conflict with operations of other transactions on the same objects.
    • If the validation test is positive, the transaction goes toa write phase. If the validation test is negative, the transaction is restarted and the changes are discarded.
  • To pass the validation test one of the condition must be true,

    • The earlier transaction Ti finish before new transaction Tj started (no overlapping transactions)
    • The new transaction Tj starts before the earlier transaction Ti started (overlapping transactions)
    • The validation phase ofatransaction comes after the write phase of another transaction, then validation is true
  • Two types of Validation,

    • Backward Validation
    • Forward Validation
  • Backward validation:

    • algorithm checks the transaction in validation phase with other preceding overlapping transactions that have entered validation phaseO
    • Write operations are ok since Read operations of earlier transactions are done already (Rule1)
    • Check if Read operations have any conflict with Write operations of earlier overlapping transactions (Rule 2) => if yes, abort transaction
  • Forward validation

    • algorithm checks transaction in validation phase with other overlapping active transactionsO
    • Read operations are ok since later transactions do not write until the transaction is done (Rule 2)
    • check if Write operations have any conflict with Read operations of overlapping active transactions (Rule 1) => if yes, abort transaction
  • Validation uses the read-write conflict rules to ensure that the scheduling ofaparticular transaction is serially equivalent with respect to all other overlapping transactions
  • Write Phase:
    • The changes are permanently applied to the database.
Please log in to add an answer.