IT & Software Exam  >  IT & Software Notes  >  Concurrency Control, - Presentation

Concurrency Control, - Presentation - IT & Software PDF Download

CONCURRENCY CONTOL

 

 

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

DEFINITION

Concurrency means allowing more than one transaction to run simultaneously on the same database.
When several transactions run concurrently database consistency can be destroyed.
To remove this problem Concurrency control is used.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Need of Concurrency Control (CC)

The concurrent execution of transactions may lead, if uncontrolled, to problems such as an inconsistent database.
CC techniques are used to ensure that multiple transactions submitted by various users do not interfere with one another in a way that produces incorrect results.
The effect on a database of any number of transactions executing in parallel must be the same as if they were executed one after another.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Advantages of Concurrent Execution of Transactions

Improvement Throughput
Reduced Waiting Time

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Problems of Concurrent Execution of Transactions

For Concurrency problems following control mechanism is required:
Lost Update Problem
The Temporary Update (Uncommitted Dependency) Problem
The Incorrect Summary (Inconsistent Analysis) Problem

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

The Lost Update Problem

In this problem, 2 transactions accessing the same database item have their operations interleaved in a way that makes the database
item incorrect.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Consider the following Example

Lost Update Problem…

Concurrency Control, - Presentation - IT & Software

 

 

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

The Temporary Update (Uncommitted Dependency) Problem

This problem occurs when one transaction is allowed to see the intermediate results of another transaction before it is committed.

 

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Consider the Example - The Temporary Update (Uncommitted Dependency) Problem

Concurrency Control, - Presentation - IT & Software

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

The Incorrect Summary (Inconsistent Analysis) Problem

This problem occurs when a transaction reads several values from a database while a second transaction updates some of them.
For e.g. Values of variable A, B, C and Sum are in column 3,4,5 and 6. The initial values of Sum is 100, 50, 25 and 0 respectively.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

The Incorrect Summary (Inconsistent Analysis) Problem

Concurrency Control, - Presentation - IT & Software

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Concurrency Control Schemes

Concurrency control schemes are divided into 2 categories:
Pessimistic or Conservative Approach
Optimistic Approach

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Pessimistic Approach

This approach says that there must be some concurrency control techniques deployed before the transactions are allowed to access the database.
Methods of Pessimistic approach:
Locking Protocol
Time Stamp Based Protocol

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Locking for Concurrency Control

Locking
It is a procedure used to control concurrent access to data. In this method when one transaction is accessing the database, a
Lock may deny access to other transactions to produce incorrect results.
Lock
It is a variable associated with a data item. It describes the status of the item with respect to possible operation that can be applied to it.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Types of Lock

Binary Lock-Two States (Lock and Unlock)
Share/Exclusive Lock (Read/Write)

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Locking Operations

Read_lock(A)= Lock-S(A)
Write_lock(A)=Lock-X(A)
Unlock(A)
S-Shared Lock
X-Exclusive Lock

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Compatibility of Locks

Concurrency Control, - Presentation - IT & Software

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Locking Example

Concurrency Control, - Presentation - IT & Software

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Problems with Locking

Dead Lock:
It happens whenever a transaction waits for a lock to be unlock (to access the data).
Problem of Starvation
When the data requested by 1 transaction is held by some other transactions again and again and the requested data is not given.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Starvation Example

T2 holds data item on Shared-mode lock.
T1 request Exclusive-mode lock on same data item.
T1 has to wait while T2 release it.
Meanwhile T3 requests same data item for Shared- mode lock and gets it from T2.
T1 still waiting.
Now T4 requests same data item for Shared-mode lock and gets it from T3.
T1 still waiting and is said to be Starved.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Pessimistic Execution

Validate
Read
Compute
Write

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Problems in Two-Phase Locking

Deadlock
Cascading roll back

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Time-Stamp (TS) based Protocol

 

In this, a unique fixed timestamp is associated with each transaction to keep the order of the transaction. It is denoted by TS (T1).

 

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Example

If a transaction T1 has been assigned timestamp TS (T1) and a new transaction TS (T2) enters the system , then TS (T1) < TS (T2)

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Two methods for implementing TS

 

Use the value of the system as the timestamp (System Clock).
Use a logical counter that is incremented after a new timestamp has been assigned.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Implementation Method

 

W-timestamp (Q) denotes the largest TS of any transaction that executed write (Q) successfully.
R-timestamp (Q) denotes the largest TS of any transaction that executed read (Q) successfully.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Optimistic Approach

It allows transaction to proceed in unsynchronized way and only checks/locks conflicts at the end.
Based on idea that conflicts are rare.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Validation Based Protocol

It consist of 3 phases depending upon whether it is Read only transaction or Read-Write transaction.
Phases are:
Read Phase
Validation Phase
Write Phase

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Validation Based Protocol Phases

Read Phase:
In this every transaction reads the values of all the data elements it needs from the database and stores them in Local variables.
All updates are applied to the Local copy of the data and not to the original database.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Validation Based Protocol Phases…

Validation Phase:
Come after end of Read phase.
Certain checks are performed to ensure that no conflict has occurred.
For Read only transactions this phase consist of checking that the data elements read are ok, no conflict is there then it is Committed.
If conflict is there then transaction is Aborted or Restarted.
For Updating transactions, it checks whether current transaction leaves database in a consistent state, if not then transaction is Aborted.

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Validation Based Protocol Phases…

Write Phase:
This phase is for only Read-Write transaction not for Read only transaction.
If the transaction has passed the validation phase successfully then all the changes made by the transaction to the Local copy are made to Final database.

 

Concurrency Control ------------------------------------------------------------------------------------- Next Slide

Optimistic Execution

Read
Compute
Validate
Write

The document Concurrency Control, - Presentation - IT & Software is a part of IT & Software category.
All you need of IT & Software at this link: IT & Software

Top Courses for IT & Software

FAQs on Concurrency Control, - Presentation - IT & Software

1. What is concurrency control in IT and software?
Ans. Concurrency control refers to the techniques and mechanisms used to manage the simultaneous execution of multiple transactions in a database or software system. It ensures that transactions do not interfere with each other and maintains data consistency and integrity.
2. Why is concurrency control important in IT and software?
Ans. Concurrency control is crucial in IT and software systems to prevent conflicts and ensure data consistency. Without proper control, concurrent transactions may result in issues like data corruption, lost updates, or inconsistent query results. It helps maintain the integrity and reliability of the system.
3. What are some common techniques used for concurrency control?
Ans. There are various techniques for concurrency control, including locking, timestamp ordering, optimistic concurrency control, and multiversion concurrency control. Locking involves acquiring and releasing locks on data items to prevent conflicts. Timestamp ordering assigns timestamps to transactions to determine their order of execution. Optimistic concurrency control assumes that conflicts are rare and checks for conflicts only at the end of a transaction. Multiversion concurrency control maintains multiple versions of data to provide concurrent access.
4. How does concurrency control impact performance in IT and software systems?
Ans. Concurrency control can have an impact on performance in IT and software systems. The overhead of acquiring and releasing locks or managing timestamps can introduce delays and reduce throughput. However, effective concurrency control techniques can optimize performance by allowing better utilization of system resources and ensuring efficient execution of concurrent transactions.
5. Can you give an example of a real-life scenario where concurrency control is important?
Ans. One example of a real-life scenario where concurrency control is important is in online banking systems. Multiple users may perform transactions simultaneously, such as transferring funds or updating account information. Concurrency control ensures that these transactions do not conflict with each other and that the account balances remain accurate and consistent.
Download as PDF
Explore Courses for IT & Software exam

Top Courses for IT & Software

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Summary

,

Concurrency Control

,

Concurrency Control

,

video lectures

,

Concurrency Control

,

pdf

,

- Presentation - IT & Software

,

Extra Questions

,

shortcuts and tricks

,

Semester Notes

,

MCQs

,

study material

,

practice quizzes

,

ppt

,

Exam

,

Previous Year Questions with Solutions

,

- Presentation - IT & Software

,

Free

,

Important questions

,

mock tests for examination

,

past year papers

,

- Presentation - IT & Software

,

Sample Paper

,

Viva Questions

,

Objective type Questions

;