









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










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