Concept of concurrency in dbms

                          CONCURRENCY


  • Concurrency is the ability of a database to allow multiple users to affect multiple transactions. 
  • This is one of the main properties that separates a database from other forms of data storage like spreadsheets.
  • Data concurrency means that many users can access data at same time.

Advantages of concurrency

The good is to serve many users and provides better throughput by sharing resources.
  • Reduced waiting time response time or turn around time.
  • Increased throughput or resource utilization
  • If we run only one transaction at a time than the acid property is sufficient but it is possible that when multiple transactions are executed concurrently than database may become inconsistent.
  • Overlapping with the input-output activity with CPU also makes the response time better.
  • But interleaving of instruction between transaction may also lead to many problems due to which concurrency control is required.

Problems due to concurrency

There are many which may occur due to concurrency,
1) Dirty read problem
If a transaction reads an uncommitted temporary value written by some other transaction than it is called dirty read problem. In this one transaction read a data item updated by another uncommitted transaction that may be future be aborted or failed. In such cases, the read value disappears from the database upon abort this is turned on dirty read the reading transaction end with incorrect results.
Example
    T1      T2
            R(A)
            W(A)
    R(A)
The values of item x which is read by T2 is called dirty read data because this data can be created by a transactions that has not been committed yet.
2) Loss update problem/ write - write problem
This problem occur when two transactions access the same data item and have their operations interleaved in a way that makes the value of some database items incorrect.
If there are two write operations of the different transaction on some data values and in between them there are no read operations then the second write over the first .consider the schedule below,
Example
    T1      T2
    R(A)
    W(A)
            W(A)
Here is a blind write that means write without a read. Here the changes made by transaction T1 are lost which is updated by a transaction T2.
3) Unrepeatable and phantom read problem
When a transaction cannot repeat the read instructions because the variable is deleted by some other transaction then this problem is called phantom read problem. In this problem at different instances of time a transaction read gives different values it is because data item might have been updated by another transaction.
This causes a problem while execution of some aggregate by a transaction and due to changes in the values of the data item by another transaction it leads to incorrect results. When a transaction read values of data item twice and another transaction's updates data item in between then the results of two read operations will differ.
Example
    T1          T2
    R(A)                
                R(A)
    Delete(A)                         
                R(A)
4) Incorrect summary problem
When one of the transactions is checking on aggregate summary function while other transactions are updating then this problem is called incorrect summary problem. The aggregate functions may calculate some values before they updated and others after they are updated.

Thank you viewers.
This is published by soumy sinha. .
If you have doubt and want to ask same related questions then pls tell us comment box.
Share with your friends and subscribe our page.

Comments

Popular posts from this blog

Introduction of Digital computer

INTRODUCTION OF DBMS

Introduction to cache memory