Docsity

Understanding Lost Updates, Dirty Reads, & Inconsistent Retrievals in Concurrency Control, Slides of Mathematics

Partial preview of the text

Download Understanding Lost Updates, Dirty Reads, & Inconsistent Retrievals in Concurrency Control and more Slides Mathematics in PDF only on Docsity!

Members Of Group

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)

In the Name of Allah , the Most Beneficent,

the Most Merciful

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. 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.
  1. 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.

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.

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.