Presentation is loading. Please wait.

Presentation is loading. Please wait.

Concurrency Control by Validation (18.9) By: Pushkar Marathe Id: 217.

Similar presentations


Presentation on theme: "Concurrency Control by Validation (18.9) By: Pushkar Marathe Id: 217."— Presentation transcript:

1 Concurrency Control by Validation (18.9) By: Pushkar Marathe Id: 217

2 Agenda Overview Architecture of the scheduler Validation rules Example Comparison of concurrency control mechanisms

3 Overview Type of optimistic concurrency control. Scheduler keeps a record of transactions rather than timestamps. Validation phase before writing values into database.

4 Architecture Scheduler should know the read and write sets for each transaction. Three phases of transactions: 1.Read: Reads from database to read set. 2.Validate: Validates by comparing the read and write sets with other transactions. 3.Write: Writes from write set to database. Serial order is maintained based on which the scheduler decides whether to validate or not.

5 To support the decision of validating three sets are maintained: 1.START: Set of all active transactions that are not validated. 2.VAL: Set of all transactions that are validated and are still active. 3.FIN: Set of all transactions that have finished execution. For these the scheduler records START(T),VAL(T),FIN(T).

6 Validation Rules Suppose there is a transaction U such that: a)U is in VAL or FIN; that is, U has validated. b)FIN(U)>START(T); that is, U did not finish before T started. c)RS(T) Π WS(U) is not empty; in particular, let it contain database element X. T reads X U writes X U start T start U validated T validating Figure 1

7 Here it is possible that U writes X after T reads X. to make sure that T got to read U’s value we need to rollback T to avoid a risk that the actions of T and U will be consistent with the serial order.

8 T reads X U writes X U validating T validating U finish Suppose there is a transaction U such that: a)U is in VAL or FIN; that is, U has validated. b)FIN(U)>START(T); that is, U did not finish before T started. c)RS(T) Π WS(U) is not empty; in particular, let it contain database element X.

9 T and U both write values of X and if we validate T then it will write X before U. Here also we rollback T so that order is not violated.

10 Comparison of three concurrency- control Mechanisms Storage Utilization Locks : Space in lock table proportional to number of database elements locked Timestamps : Space proportional to database elements that have been accessed recently. Validation : Space proportional to currently active transactions and some transactions that finished just some time before the current started.

11 We can also compare based on ability of transactions to complete without delay. Locking delays transactions but avoids rollback. Locking delays transactions but avoids rollback. If interface is low, then neither timestamps nor validations will cause rollbacks. If interface is low, then neither timestamps nor validations will cause rollbacks. When rollback necessary timestamps can catch problems earlier than validation. When rollback necessary timestamps can catch problems earlier than validation.

12 THANK YOU


Download ppt "Concurrency Control by Validation (18.9) By: Pushkar Marathe Id: 217."

Similar presentations


Ads by Google