Cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control : Theory Professor Elke A. Rundensteiner.

Slides:



Advertisements
Similar presentations
1 Shivnath Babu Concurrency Control (II) CS216: Data-Intensive Computing Systems.
Advertisements

CS 277: Database System Implementation Notes 11: View Serializability
Database Systems (資料庫系統)
Unit 9 Concurrency Control. 9-2 Wei-Pang Yang, Information Management, NDHU Content  9.1 Introduction  9.2 Locking Technique  9.3 Optimistic Concurrency.
Conflict Serializability Example Murat Kantarcioglu.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
1 Lecture 10: Transactions. 2 The Setting uDatabase systems are normally being accessed by many users or processes at the same time. wBoth queries and.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
1 Concurrency Control Conflict serializability Two phase locking Optimistic concurrency control Source: slides by Hector Garcia-Molina.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control Professor Elke A. Rundensteiner.
Concurrency Control II
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 2: Enforcing Serializable Schedules Professor Chen Li.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #23 Concurrency Control Professor Elke A. Rundensteiner.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery.
Kyoung-Hwan Yun (#110). Conflicts Precedence Graphs and a Test for Conflict- Serializability.
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 7: View-Serializable Schedules Professor Chen Li.
1 CS216 Advanced Database Systems Shivnath Babu Notes 11: Concurrency Control.
CS4432: Database Systems II Lecture #26 Concurrency Control and Recovery Professor Elke A. Rundensteiner.
Quick Review of Apr 29 material
Conflict-Serializability Bharath Kumar Manur Venkataramana Class ID No:- 110.
Concurrent Transactions Even when there is no “failure,” several transactions can interact to turn a consistent state into an inconsistent state.
Conflict-Serializability (section 18.2 of Concurrency Control) - Amith KC Student ID –
Concurrency. Busy, busy, busy... In production environments, it is unlikely that we can limit our system to just one user at a time. – Consequently, it.
Transaction Processing: Concurrency and Serializability 10/4/05.
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
Database Management Systems I Alex Coman, Winter 2006
Concurrency Control 18.1 – 18.2 Chiu Luk CS257 Database Systems Principles Spring 2009.
Cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control Professor Elke A. Rundensteiner.
CS4432transaction management1 CS4432: Database Systems II Lecture #23 Transaction Management Professor Elke A. Rundensteiner.
1 Concurrency Control. 2 Transactions A transaction is a list of actions. The actions are reads (written R T (O)) and writes (written W T (O)) of database.
Cs4432concurrency control1 CS4432: Database Systems II Concurrency Control.
CS4432: Database Systems II Transaction Management Motivation 1.
Copyright © 2004 Pearson Education, Inc.. Chapter 17 Introduction to Transaction Processing Concepts and Theory.
Chapter 181 Chapter 18: Concurrency Control (Slides by Hector Garcia-Molina,
Cs4432concurrency control1 CS4432: Database Systems II Lecture #22 Concurrency Control: Locking-based Protocols Professor Elke A. Rundensteiner.
1 Notes 09: Transaction Processing Slides are modified from the CS 245 class slides of Hector Garcia- Molina.
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.
CS 162 Discussion Section Week 9 11/11 – 11/15. Today’s Section ●Project discussion (5 min) ●Quiz (10 min) ●Lecture Review (20 min) ●Worksheet and Discussion.
1 Concurrency Control II: Locking and Isolation Levels.
Chapter 15: Transactions Loc Hoang CS 157B. Definition n A transaction is a discrete unit of work that must be completely processed or not processed at.
1 CS542 Concurrency Control: Theory and Protocol Professor Elke A. Rundensteiner.
1 Concurrency Control Lecture 22 Ramakrishnan - Chapter 19.
Concurrency (cont.) Schedule. In multiprogramming environment, Several transaction run concurrently Database consistency can be destroy Schedules to ensure.
Jinze Liu. ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation:
6/18/2016Transactional Information Systems3-1 Part II: Concurrency Control 3 Concurrency Control: Notions of Correctness for the Page Model 4 Concurrency.
Concurrency Control.
CS216: Data-Intensive Computing Systems
Database Management System
Transactions.
Temple University – CIS Dept. CIS661 – Principles of Data Management
Chapter 15: Transactions
Transactions Sylvia Huang CS 157B.
Lecture 21: Concurrency & Locking
CS162 Operating Systems and Systems Programming Review (II)
Conflict-Serializability (section 18.2 of Concurrency Control)
6.830 Lecture 12 Transactions: Isolation
Conflicts.
Transaction Management Overview
Lecture 22: Intro to Transactions & Logging IV
Transaction management
CONCURRENCY CONTROL 18.1 Serial and Serializable Schedule
CPSC-608 Database Systems
C. Faloutsos Transactions
Temple University – CIS Dept. CIS616– Principles of Data Management
UNIT -IV Transaction.
Transaction Serializability
Presentation transcript:

cs4432concurrency control1 CS4432: Database Systems II Lecture #21 Concurrency Control : Theory Professor Elke A. Rundensteiner

cs4432concurrency control2 Concepts Transaction: sequence of r i (x), w i (x) actions Conflicting actions: read/write on same resource A: r 1(A) w 2(A) w 1(A) w 2(A) r 1(A) w 2(A) Schedule: represents chronological order in which actions are executed Serial schedule: no interleaving of trans/actions

cs4432concurrency control3 Schedule C T1T2 Read(A); A  A+100 Write(A); Read(A);A  A  2; Write(A); Read(B); B  B+100; Write(B); Read(B);B  B  2; Write(B); AB

cs4432concurrency control4 Sc’=r 1 (A)w 1 (A) r 1 (B)w 1 (B)r 2 (A)w 2 (A)r 2 (B)w 2 (B) T 1 T 2 Example: Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B)

cs4432concurrency control5 Returning to Sc Sc=r 1 (A)w 1 (A)r 2 (A)w 2 (A)r 1 (B)w 1 (B)r 2 (B)w 2 (B) T 1  T 2 T 1  T 2  no cycles  Sc is “equivalent” to a serial schedule, I.e., in this case (T 1,T 2 ).

cs4432concurrency control6 Schedule D T1T2 Read(A); A  A+100 Write(A); Read(A);A  A  2; Write(A); Read(B);B  B  2; Write(B); Read(B); B  B+100; Write(B); AB

cs4432concurrency control7 Now for Sd: Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) Sd=r 1 (A)w 1 (A) r 1 (B)w 1 (B)r 2 (A)w 2 (A)r 2 (B)w 2 (B) T1 T2

cs4432concurrency control8 Or, let’s try for Sd: Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) Sd=r 2 (A)w 2 (A)r 2 (B)w 2 (B) r 1 (A)w 1 (A)r 1 (B)w 1 (B) T1 T2

cs4432concurrency control9 In short, Schedule D cannot be “fixed” : Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) as a matter of fact, there seems to be no save way to transform this Sd into an equivalent serial schedule !?

cs4432concurrency control10 For Schedule D: Sd=r 1 (A)w 1 (A)r 2 (A)w 2 (A) r 2 (B)w 2 (B)r 1 (B)w 1 (B) T 1  T 2 T 2  T 1 T 1 T 2 Sd cannot be rearranged into serial schedule

cs4432concurrency control11 Idea: Swap non-conflicting operation pairs to see if you can go to a serial schedule.

cs4432concurrency control12 Definition S 1, S 2 are conflict equivalent schedules if S 1 can be transformed into S 2 by a series of swaps of non-conflicting actions.

cs4432concurrency control13 Definition A schedule is conflict serializable if it is conflict equivalent to some serial schedule.

cs4432concurrency control14 Answer: A Precedence Graph ! How determine this ?

cs4432concurrency control15 Nodes: transactions in S Arcs: Ti  Tj whenever - p i (A), q j (A) are actions in S - p i (A) < S q j (A) - at least one of p i, q j is a write Precedence graph P(S) (S is schedule )

cs4432concurrency control16 Exercise: What is P(S) for S = w 3 (A) w 2 (C) r 1 (A) w 1 (B) r 1 (C) w 2 (A) r 4 (A) w 4 (D) Is S conflict-serializable?

cs4432concurrency control17 Another Exercise: What is P(S) for S = w 1 (A) r 2 (A) r 3 (A) w 4 (A) ? Is S conflict-serializable?

cs4432concurrency control18 Lemma S 1, S 2 conflict equivalent  P(S 1 )=P(S 2 ) Proof: Assume P(S 1 )  P(S 2 )   T i : T i  T j in S 1 and not in S 2  S 1 = …p i (A)... q j (A)… p i, q j S 2 = …q j (A)…p i (A)... conflict  S 1, S 2 not conflict equivalent

cs4432concurrency control19 Note: P(S 1 )=P(S 2 )  S 1, S 2 conflict equivalent?

cs4432concurrency control20 Note: P(S 1 )=P(S 2 )  S 1, S 2 conflict equivalent Counter example: S 1 =w 1 (A) r 2 (A) w 2 (B) r 1 (B) S 2 =r 2 (A) w 1 (A) r 1 (B) w 2 (B)

cs4432concurrency control21 Theorem P(S 1 ) acyclic  S 1 conflict serializable (  ) Assume S 1 is conflict serializable   S s : S s, S 1 conflict equivalent  P(S s ) = P(S 1 )  P(S 1 ) acyclic since P(S s ) is acyclic

cs4432concurrency control22 (  ) Assume P(S 1 ) is acyclic Transform S 1 as follows: (1) Take T 1 to be transaction with no incident arcs (2) Move all T 1 actions to the front S 1 = ……. q j (A)……. p 1 (A)….. (3) we now have S 1 = (4) repeat above steps to serialize rest! T 1 T 2 T 3 T 4 Theorem P(S 1 ) acyclic  S 1 conflict serializable

cs4432concurrency control23 Theorem holds: P(S 1 ) acyclic  S 1 conflict serializable