The document discusses different concurrency control protocols used to maintain consistency when multiple transactions access shared data concurrently. It describes three main problems that can occur without concurrency control: lost updates, dirty reads, and unrepeatable reads. It then explains three common concurrency control protocols - lock-based, timestamp ordering, and validation-based protocols - and provides details on how each works.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
45 views
Foriegn Policy
The document discusses different concurrency control protocols used to maintain consistency when multiple transactions access shared data concurrently. It describes three main problems that can occur without concurrency control: lost updates, dirty reads, and unrepeatable reads. It then explains three common concurrency control protocols - lock-based, timestamp ordering, and validation-based protocols - and provides details on how each works.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16
Waqas Ali (BSIT-F17-43)
Zartash Anwar (BSIT-F17-50)
Muhammad Haseeb Riaz (BSIT-F17-47) Muhammad Qasim Ali (BSIT-F17-33) Muhammad Shahroz Arshad (BSIT-F17-37) الر ِح ْي ِم الر ْح ٰم ِن َّ ِب ْس ِم ِ هللا َّ Concurrency Control with Locking Serializability Concurrency Control
In the concurrency control, the multiple transactions can
be executed simultaneously.
It may affect the transaction result. It is highly important
to maintain the order of execution of those transactions. Problems of concurrency control Several problems can occur when concurrent transactions are executed in an uncontrolled manner. Following are the three problems in concurrency control.
Lost updates Dirty read Unrepeatable read 1. Lost Update Problem
When two transactions that access the same database
items contain their operations in a way that makes the value of some database item incorrect, then the lost update problem occurs. 2. Dirty Read
The dirty read occurs in the case when one transaction
updates an item of the database, and then the transaction fails for some reason. The updated database item is accessed by another transaction before it is changed back to the original value. 3. Inconsistent Retrievals Problem
Inconsistent Retrievals Problem is also known as
unrepeatable read. When a transaction calculates some summary function over a set of data while the other transactions are updating the data, then the Inconsistent Retrievals Problem occurs. Concurrency Control Protocol Concurrency control protocols ensure atomicity, isolation, and serializability of concurrent transactions. The concurrency control protocol can be divided into three categories:
Lock based protocol
Time-stamp protocol Validation based protocol Lock-Based Protocol In this type of protocol, any transaction cannot read or write data until it acquires an appropriate lock on it. There are two types of lock: 1. Shared lock: It is also known as a Read-only lock. In a shared lock, the data item can only read by the transaction. It can be shared between the transactions because when the transaction holds a lock, then it can't update the data on the data item. 2. Exclusive lock: In the exclusive lock, the data item can be both reads as well as written by the transaction. This lock is exclusive, and in this lock, multiple transactions do not modify the same data simultaneously. Timestamp Ordering Protocol The Timestamp Ordering Protocol is used to order the transactions based on their Timestamps. The order of transaction is nothing but the ascending order of the transaction creation. The priority of the older transaction is higher that's why it executes first. To determine the timestamp of the transaction, this protocol uses system time or logical counter. The lock-based protocol is used to manage the order between conflicting pairs among transactions at the execution time. But Timestamp based protocols start working as soon as a transaction is created. Advantages and Disadvantages of TO protocol: TO protocol ensures serializability since the precedence graph is as follows:
TS protocol ensures freedom from deadlock that means no
transaction ever waits. But the schedule may not be recoverable and may not even be cascade- free. Validation Based Protocol Validation phase is also known as optimistic concurrency control technique. In the validation based protocol, the transaction is executed in the following three phases:
Read phase: In this phase, the transaction T is read and
executed. It is used to read the value of various data items and stores them in temporary local variables. It can perform all the write operations on temporary variables without an update to the actual database. Validation phase: In this phase, the temporary variable value will be validated against the actual data to see if it violates the serializability.
Write phase: If the validation of the transaction is
validated, then the temporary results are written to the database or system otherwise the transaction is rolled back.