***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Wednesday 3 April 2024

    Concurrency Control in DBMS

    Concurrency control is a very important concept of DBMS which ensures the simultaneous execution or manipulation of data by several processes or user without resulting in data inconsistency.

    Concurrency Control deals with interleaved execution of more than one transaction.

    Concurrency control provides a procedure that is able to control concurrent execution of the operations in the database. 

    Concurrency Control Problems

    The database transaction consists of two major operations “Read” and “Write”. It is very important to manage these operations in the concurrent execution of the transactions in order to maintain the consistency of the data. 

    1. Dirty Read Problem (Write-Read conflict)

    Dirty read problem occurs when one transaction updates an item but due to some unconditional events that transaction fails but before the transaction performs rollback, some other transaction reads the updated value. Thus creates an inconsistency in the database.

    Ex: Consider two transactions T1 and T2

    ·         Transaction T1 modifies a database record without committing the changes.

    ·         T2 reads the uncommitted data changed by T1

    ·         T1 performs rollback

    ·         T2 has already read the uncommitted data of T1 which is no longer valid, thus creating inconsistency in the database.

    2. Lost Update Problem

    Lost update problem occurs when two or more transactions modify the same data, resulting in the update being overwritten or lost by another transaction.

    Ex: Consider two transactions T1 and T2

    ·         T1 reads the value of an item from the database.

    ·         T2 starts and reads the same database item.

    ·         T1 updates the value of that data and performs a commit.

    ·         T2 updates the same data item based on its initial read and performs commit.

    ·         This result in the modification of T1 gets lost by the T2’s write which causes a lost update problem in the database.

    Concurrency control ensures transaction atomicity, isolation, consistency, and serializability.

     

     

     

     

     

    No comments:

    Post a Comment