Optimistic Methods for Concurrency Control By: H.T. Kung and John Robinson Presented by: Frederick Ramirez.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

CM20145 Concurrency Control
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Lecture plan Transaction processing Concurrency control
Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Concurrency Control WXES 2103 Database. Content Concurrency Problems Concurrency Control Concurrency Control Approaches.
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
University of Tampere, CS Department Distributed Transaction Management Jyrki Nummenmaa
1 CSIS 7102 Spring 2004 Lecture 9: Recovery (approaches) Dr. King-Ip Lin.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Concurrency Control II. General Overview Relational model - SQL  Formal & commercial query languages Functional Dependencies Normalization Physical Design.
CS6223: Distributed Systems
Lock-Based Concurrency Control
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
Concurrency Control Nate Nystrom CS 632 February 6, 2001.
Quick Review of Apr 29 material
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Distributed Systems Fall 2010 Transactions and concurrency control.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
Transaction Processing: Concurrency and Serializability 10/4/05.
Transaction Management
Concurrency Control by Validation (Section 18.9) Priyadarshini.S Cs_257_117_ch 18_18.9.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Remote Backup Systems.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Alternative Concurrency Control Methods R&G - Chapter 17.
Transaction. A transaction is an event which occurs on the database. Generally a transaction reads a value from the database or writes a value to the.
Transactions and concurrency control
Transactions Sylvia Huang CS 157B. Transaction A transaction is a unit of program execution that accesses and possibly updates various data items. A transaction.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
Formal-Concurrency-Control General Comments Information needed by Concurrency Controllers –Locks on database objects (System-R, Ingres, Rosenkrantz…) –Time.
Lecture 12 Recoverability and failure. 2 Optimistic Techniques Based on assumption that conflict is rare and more efficient to let transactions proceed.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
TRANSACTION MANAGEMENT R.SARAVANAKUAMR. S.NAVEEN..
Chapter 16 Recovery Yonsei University 1 st Semester, 2015 Sanghyun Park.
A Survey on Optimistic Concurrency Control CAI Yibo ZHENG Xin
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Lecture 9- Concurrency Control (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Switch off your Mobiles Phones or Change Profile to Silent Mode.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Academic Year 2014 Spring Academic Year 2014 Spring.
11th International Conference on Web-Age Information Management July 15-17, 2010 Jiuzhaigou, China V Locking Protocol for Materialized Aggregate Join Views.
SYSTEMS IMPLEMENTATION TECHNIQUES TRANSACTION PROCESSING DATABASE RECOVERY DATABASE SECURITY CONCURRENCY CONTROL.
Remote Backup Systems.
Transaction Management
Concurrency Control Techniques
Transaction Management and Concurrency Control
Extra slide #3.
Concurrency Control.
Multiple Granularity Granularity is the size of data item  allowed to lock. Multiple Granularity is the hierarchically breaking up the database into portions.
General Comments Information needed by Concurrency Controllers
Transactions.
Transactions Sylvia Huang CS 157B.
Chapter 10 Transaction Management and Concurrency Control
Concurrency Control WXES 2103 Database.
Chapter 15 : Concurrency Control
Recovery System.
Concurrency Control by Validation
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Concurrency Control Chapter 17
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
Remote Backup Systems.
UNIT -IV Transaction.
Transactions, Properties of Transactions
Presentation transcript:

Optimistic Methods for Concurrency Control By: H.T. Kung and John Robinson Presented by: Frederick Ramirez

Roadmap Introduction Locking Optimistic Concurrency Validation Serial Validation Parallel Validation Conclusion Questions?

Introduction Concurrency control is the management of contention for data resources There are two general approaches to concurrency control: locking and backup. The more popular approach are based on locking schemes This paper investigates solutions to concurrency control relying almost entirely on a backup mechanism The authors identify a number of inherent disadvantages of locking and proposes an optimistic approach

Optimistic Approach  ”Optimistic”, because it is based on the observation that, in most applications, the likelihood of two transactions accessing the same object is low  The approach “hopes” that conflicts do not occur and transactions are allowed to proceed as though there were no possibility of conflict  Objective is to minimize the time over which a given resource would be unavailable for use by other transactions  A concurrency control scheme is considered pessimistic when it locks a given resource early in the data-access transaction and does not release it until the transaction is closed

Target set Consider the problem of providing shared access to a database organized as a collection of objects If the goal is to maximize throughput of accesses, then there are at least two cases where highly concurrent access is desirable: 1) The amount of data is sufficiently great that at any given time only a fraction of the database can be present in memory 2) Even if the entire database can be present in memory, there may be multiple processors

Disadvantages of Locking Description: A mechanism where one process can deny certain processes access to some portion of the DB Disadvantages: Lock maintenance represents overhead There are no general-purpose deadlock-free locking protocols for DBs w/ high concurrency Concurrency is significantly lowered whenever it is necessary to leave some congested node locked Locks cannot be released until the end of the transaction

Disadvantages of Locking continued Disadvantages: Locking may be necessary only in the worst case

Optimistic Concurrency Control Kung and Robinson proposes two families of optimistic concurrency control which eliminate the use of locking. This approach provides the following Advantages: It is deadlock free Avoids any time consuming node-locked scenarios If the transactions become query dominant, the concurrency control overhead becomes almost negligible

continued Advantages The approach is completely general. It applies equally well to any shared directed graph structure and associated access algorithm

Idea behind Optimistic Approach Since reading a value or a pointer from a node can never cause a loss of integrity, reads are completely unrestricted Writes are severely restricted. Transactions consist of three phases: Read Phase: All writes take place on local copies of the object to be modified Validations Phase: The step in which it is determined that the transaction will not cause a loss of integrity Write Phase: Copies are made global

Read and Write Phase Read is also referred to as the “Working Phase” Each transaction has a tentative version of each of the object that it updates READ operations are performed immediately WRITE operations record the new values of the objects as tentative values Two records are kept of the objects accessed within a transaction: a read set and a write set

Read and Write Phase If validation succeeds, then the transaction enters the write phase After write phase, all written values become “global” When a transaction completes, it will request its validation and write phases via transactionEnd’ call

Validation Phase Uses a particularly strong form of validation This is especially important with long-running transactions Method uses an overqualified update scheme to test whether the underlying data source has been updated by another transaction since the beginning of the current transaction Kung and Robinson employ Serial Equivalence for verifying the correctness of concurrent execution of transactions.

Idea behind Correctness Criterion Each transaction is assumed to have been written so as to individually preserve integrity of the data structure If Tinitial satisfies all integrity criteria and the concurrent execution of T1, T2,…,Tn are serially equivalent from (1), by repeated application of the integrity-preserving property, Tfinal satisfies all integrity criteria It is much easier to verify the two items above than it is to verify directly that every concurrent execution of transactions preserves integrity of the DB

Validation of Serial Equivalence Explicitly assigns each transaction a Transaction Number, t(i), at the end of the read phase Transaction numbers are assigned in order, If the transaction is validated and completes successfully, it retains this number If it fails the validation checks and is aborted, or if the transaction is read-only, the number is released for reassignment Transaction numbers are integers assigned in ascending sequence The number of a transaction defines its position in time Tid satisfies the following property: t(i)<t(j) Operations conform to the following validation conditions: Ti must not read objects being written by Tj Tj must not read objects being written by Ti Ti must not write objects being written by Tj and Tj must not write objects being written by Ti

Earlier committed transactions WorkingValidationUpdate T 1 T v Transaction being validated T 2 T 3 Later active transactions active 1 2 Figure 12.28

The earlier committed transactions are T1, T2 and T3. T1 committed before Tv started. (earlier means they started validation earlier) T2 and T3 committed before Tv finished its working phase Validation consists of comparing the READ set of Tv with the write set of T2 and T3 Conflicts are resolved by aborting the transaction undergoing validation If transaction being validated does not have any read operations, it does not have to be checked Optimistic concurrency requires that the write sets of old committed versions of objects corresponding to recently committed transactions are retained until there are no unvalidated overlapping transactions which might conflict When a transaction is successfully validated, its transaction number and write set are recorded in a list that is maintained by the transaction service

Considerations to Model Case 1: A transaction T has an arbitrarily long read phase Case 2: What should be done when validation fails? Case 3: What should be done in the case where validation continually fails?

Serial Validation First of the two families of concurrency controls proposed by Kung and Robinson This model implements validation conditions (1) and (2) of serial equivalence When no two transactions may overlap in the write phase, condition 3 is satisfied (Implies write phase is serial execution) Implementation consists of placing the assignment of Tid, validation, and subsequent write phase all in a critical section

Parallel Validation Concurrency control that uses all three of the validation conditions Retains optimization properties of Serial Validation Extends validation to allow multiple transactions to be in the validation phase at the same time Condition 3 must be satisfied as well as condition 2. The write set of the transaction being validated must be checked for overlaps with the write set of earlier overlapping transactions

Parallel Validation tend:=( <finish tn:=tnc; finish active:=(make a copy of active) active:=active U {id of this transaction} valid:=true; for t from start tn+1 to finish tn do if (write set of transaction with transaction number t intersects read set) then valid:=false; for i E finish active do if (write set of transaction Ti intersects read set or write set) then valid:= false; if valid then( (write phase); <tnc:=tnc+1; tn:=tnc; active:=active—{id of this transaction}>; (cleanup)) else( ; (backup)))

Applications Query dominant searches Large Tree structured indexes Ex: B-Trees

Conclusion In a locking approach, transactions are controlled by having them wait at certain points, while in an optimistic approach, transactions are controlled by backing them up In a locking approach, serial equivalence can be proven by partially ordering the transactions by first access time for each object, while in an optimistic approach, transactions are ordered by transaction number assignment The major difficulty in locking approaches is deadlock, in an optimistic approach, the major difficulty is starvation