Home » DBMS

Concurrency and problem due to concurrency in DBMS

Learn: In this article, we are going to discuss about concurrency some advantages of concurrency and problems due to concurrency and basics about schedule in Database management system.
Submitted by Prerana Jain, on June 15, 2018

Concurrency

The ability of a database system which handles simultaneously or a number of transactions by interleaving parts of the actions or the overlapping this is called concurrency of the system.

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.

Schedule

A schedule contains two or more transaction or one after another. All the instructions of each individual transaction will appear in the schedule contact switching can be done but we cannot change the order of execution.

Types of schedule

Schedule can be classified into mainly two types,

  1. Serial schedule
    if the schedule runs only one transaction at a time and can start other transaction after computing the first than it is called serial schedule. If there are n schedules than ! n different schedules are possible.
  2. Non-serial/concurrent schedule
    A schedule is said to be non-serial schedule if we start executing other transactions before computing the first one. A schedule in which sequence of instructions of transactions appear in the same order as they appear in individual transactions but the instructions may be interleaved with the instructions of different transactions i.e. concurrent execution of transaction takes place.





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.