CS 347 Parallel and Distributed Data Processing
|
|
- Anne Robertson
- 5 years ago
- Views:
Transcription
1 CS 347 Parallel and Distributed Data Processing Spring 2016 Notes 5: Concurrency Control
2 Topics Data Database design Queries Decomposition Localization Optimization Transactions Concurrency control Reliability Replication CS 347 Notes 5 2
3 Transactions Programs with database accesses Always end in commit or abort CS 347 Notes 5 3
4 Transactions Programs with database accesses Always end in commit or abort Properties Atomicity Consistency Isolation Durability CS 347 Notes 5 4
5 Transactions Programs with database accesses Always end in commit or abort Concurrency control Properties Atomicity Consistency Isolation Durability Reliability CS 347 Notes 5 5
6 Concurrency Control Synchronization primitives Mutual exclusive access Execution ordering Pessimistic Optimistic CS 347 Notes 5 6
7 Concurrency Control Schedules and serializability Locking Timestamp ordering CS 347 Notes 5 7
8 Schedule A schedule represents how a set of transactions are executed Just like in a centralized system Schedules may be good (i.e., preserve constraints) or bad CS 347 Notes 5 8
9 Schedule Example X Y constraint: X = Y Node X Node Y T 1 T 2 1 (T 1 ) a X 5 (T 2 ) c X 2 (T 1 ) X a (T 2 ) X 2c 3 (T 1 ) b Y 7 (T 2 ) d Y 4 (T 1 ) Y b (T 2 ) Y 2d Precedence relation CS 347 Notes 5 9
10 Schedule Schedule S Node X Node Y 1 (T 1 ) a X 2 (T 1 ) X a (T 2 ) c X 3 (T 1 ) b Y 6 (T 2 ) X 2c 4 (T 1 ) Y b (T 2 ) d Y 8 (T 2 ) Y 2d Precedence Intra-transaction Inter-transaction If X = Y = 0 initially, X = Y = 200 at the end CS 347 Notes 5 10
11 Schedule Schedule S Node X Node Y 1 (T 1 ) a X 2 (T 1 ) X a (T 2 ) c X 3 (T 1 ) b Y 6 (T 2 ) X 2c 4 (T 1 ) Y b (T 2 ) d Y 8 (T 2 ) Y 2d If X = Y = 0 initially, X = Y = 200 at the end Precedence Intra-transaction Inter-transaction Other T 1, T 2 schedules with different outcomes? CS 347 Notes 5 11
12 Schedule Formal definition Let T= { T 1, T 2,, T n } be a set of transactions A schedule S over T is a partial order with ordering relation < S where: 1) S = T i 2) < S < T n i = 1 n i = 1 i 3) For any two conflicting operations p, q S, either p < S q or q < S p On same data, at least one is a write CS 347 Notes 5 12
13 Schedule Example T 1 T 2 T 3 r 1 [X] w 1 [X] r 2 [X] w 2 [Y] w 2 [X] r 3 [X] w 3 [X] w 3 [Y] w 3 [Z] S r 2 [X] w 2 [Y] w 2 [X] r 3 [X] w 3 [X] w 3 [Y] w 3 [Z] r 1 [X] w 1 [X] CS 347 Notes 5 13
14 Schedule Precedence graph The precedence graph P(S) for some schedule is a directed graph Nodes Edges the transactions in S T i T j is an edge iff p T i, q T j such that p, q conflict and p < S q CS 347 Notes 5 14
15 Schedule Example r 3 [X] w 3 [X] S r 1 [X] w 1 [X] w 1 [Y] r 2 [X] w 2 [Y] P(S) T 2 T 1 T 3 T 2 T 1 because r 2 [X] w 1 [X], w 2 [Y] w 1 [Y] T 1 T 3 because w 1 [X] r 3 [X], w 1 [X] w 3 [X] T 2 T 3 because r 2 [X] w 3 [X] CS 347 Notes 5 15
16 Serializability Theorem A schedule S is (conflict-)serializable iff P(S) is acyclic CS 347 Notes 5 16
17 Serializability Enforcement Locks Timestamps CS 347 Notes 5 17
18 Locking Just like in a centralized system But with multiple lock managers scheduler 1 D 1 D 1 locks... scheduler 2 D 2 D 2 locks node 1 node 2 CS 347 Notes 5 18
19 Locking Just like in a centralized system But with multiple lock managers scheduler 1 D 1 D 1 locks... scheduler 2 D 2 D 2 locks node 1 access & lock data T access & lock data release all locks at the end node 2 CS 347 Notes 5 19
20 Locking Reminder Using locks alone does not guarantee serializability CS 347 Notes 5 20
21 Locking Reminder Using locks alone does not guarantee serializability Node X L(X) 1 (T 1 ) a X 2 (T 1 ) X a+100 R(X) Node Y L(X) L(Y) 3 (T 2 ) c X 5 (T 2 ) d Y 4 (T 2 ) X 2c 6 (T 2 ) Y 2d R(X) R(Y) L(Y) 7 (T 1 ) b Y 8 (T 1 ) Y b+100 R(Y) CS 347 Notes 5 21
22 Locking Node X Node Y L(X) 1 (T 1 ) a X 2 (T 1 ) X a+100 R(X) L(X) L(Y) 3 (T 2 ) c X 5 (T 2 ) d Y 4 (T 2 ) X 2c 6 (T 2 ) Y 2d R(X) R(Y) L(Y) 7 (T 1 ) b Y 8 (T 1 ) Y b+100 R(Y) If X = Y = 0 initially, X = 200 and Y = 100 at the end serializable CS 347 Notes 5 22
23 Two-Phase Locking One solution locks time CS 347 Notes 5 23
24 Two-Phase Locking One solution locks time May lead to cascading aborts CS 347 Notes 5 24
25 Strict Two-Phase Locking locks time Only release on commit or abort to avoid cascading aborts CS 347 Notes 5 25
26 Locking with Shared Memory P P M Where does lock table live? How do we avoid race conditions? CS 347 Notes 5 26
27 Locking with Shared Disk P P M M Where does lock table live? How do we avoid race conditions? CS 347 Notes 5 27
28 Locking with Shared Disk Fixed partition Dynamic partition For each data item X need to have lock table entry L(X) For each L(X) need to know current owner processor P(X) Replicate P(X) at all processors CS 347 Notes 5 28
29 Deadlocks Remember, 2PL may lead to deadlocks T 1 T 2 L(X), r(x), L(Y) L(Y), r(y), L(X) Need to avoid cycles in wait-for graph (WFG) between transactions Many deadlock solutions Detection vs. prevention Timeouts Wait-die Wound-wait CS 347 Notes 5 29
30 Deadlocks Even if nodes check WFG locally, global deadlocks are possible T 1 T 2 T 1 T 2 Local WFG: No cycles Local WFG: No cycles CS 347 Notes 6 30
31 Deadlocks Need to combine local WFG to discover global deadlocks T 1 T 2 T 1 T 2 Local WFG: No cycles Local WFG: No cycles T 1 T 2 E.g., at central detection node CS 347 Notes 6 31
32 Timestamp Ordering Assign timestamp when transaction begins If ts(t 1 ) < ts(t 2 ) < < ts(t n ) then scheduler produces history equivalent to T 1, T 2,..., T n CS 347 Notes 5 32
33 Timestamp Ordering Rule If p i [x] and q j [x] are conflicting operations then p i [x] < S q j [x] iff ts(t i ) < ts (T j ) CS 347 Notes 5 33
34 Timestamp Ordering Example Non-serializable schedule S Node X Node Y (T 1 ) a X (T 2 ) d Y (T 1 ) X a+100 (T 2 ) Y 2d (T 2 ) c X (T 1 ) b Y (T 2 ) X 2c (T 1 ) Y b+100 CS 347 Notes 5 34
35 Timestamp Ordering Example Non-serializable schedule S ts ( T 1 ) < ts ( T 2 ) Node X Node Y (T 1 ) a X (T 2 ) d Y (T 1 ) X a+100 (T 2 ) Y 2d (T 2 ) c X (T 1 ) b Y (T 2 ) X 2c (T 1 ) Y b+100 reject! CS 347 Notes 5 35
36 Timestamp Ordering Example Non-serializable schedule S ts ( T 1 ) < ts ( T 2 ) Node X Node Y (T 1 ) a X (T 2 ) d Y (T 1 ) X a+100 (T 2 ) Y 2d (T 2 ) c X (T 1 ) b Y (T 2 ) X 2c (T 1 ) Y b+100 reject! abort T 1 abort T 1 abort T 2 abort T 2 CS 347 Notes 5 36
37 Strict TO Lock written items until it is certain that writing transaction has been successful Avoid cascading aborts CS 347 Notes 5 37
38 Strict TO Example Non-serializable schedule S ts ( T 1 ) < ts ( T 2 ) Node X Node Y (T 1 ) a X (T 2 ) d Y (T 1 ) X a+100 (T 2 ) Y 2d (T 2 ) c X delay (T 1 ) b Y reject! abort T 1 CS 347 Notes 5 38
39 Strict TO Example Non-serializable schedule S ts ( T 1 ) < ts ( T 2 ) Node X Node Y (T 1 ) a X (T 2 ) d Y (T 1 ) X a+100 (T 2 ) Y 2d (T 2 ) c X delay (T 1 ) b Y reject! abort T 1 (T 2 ) c X (T 2 ) X 2c abort T 1 CS 347 Notes 5 39
40 TO Scheduler X data item mtsr[x] mtsw[x] maximum timestamp of a transaction that read X maximum timestamp of a transaction that wrote X nr[x] number of transactions currently reading X (= 0, 1, 2, ) nw[x] number of transactions currently writing X (= 0 or 1) CS 347 Notes 5 40
41 TO Scheduler Part 1 r i [X] arrives if ts(t i ) < mtsw[x] then abort T i else if ts(t i ) > mtsr[x] then mtsr[x] ts(t i ) if queue is empty and nw[x] = 0 then nr[x] nr[x] + 1 initiate read X else add r i [X] to queue CS 347 Notes 5 41
42 TO Scheduler Part 2 w i [X] arrives if ts(t i ) < mtsw[x] or ts(t i ) < mtsr[x] then abort T i else mtsw[x] ts(t i ) if queue is empty and nw[x] = 0 and nr[x] = 0 then nw[x] 1 write X and wait for T i to finish else add w i [X] to queue CS 347 Notes 5 42
43 TO Scheduler Part 3 When some operation o (read or write) on X finishes no[x] no[x] 1 not_done true while not_done o j [X] head of queue (with smallest timestamp) if o = w and nr[x] = 0 and nw[x] = 0 then remove o j [X] from queue CS 347 Notes 5 43
44 TO Scheduler Part 3 When some operation o (read or write) on X finishes nw[x] 1 write X and wait for T j to finish else if o = r and nw[x] = 0 then remove o j [X] from queue nr[x] nr[x] + 1 initiate read X else not_done true CS 347 Notes 5 44
45 TO Scheduler For reads nr[x] nr[x] + 1; initiate read X For writes nw[x] 1; write X and wait for T i to finish In part 3, the end of a write is only processed when all other writes for the transaction have completed CS 347 Notes 5 45
46 TO Scheduler If a transaction is aborted, it must be retried with a new larger timestamp mtsr[x] = 10 mtsw[x] = 9 ts(t) = 8 read X CS 347 Notes 5 46
47 TO Scheduler If a transaction is aborted, it must be retried with a new larger timestamp mtsr[x] = 10 mtsw[x] = 9 ts(t) = 8 starvation (keeps being aborted), should use ts(t) = 11 read X CS 347 Notes 5 47
48 TO Scheduler Theorem If S is a schedule representing an execution by a TO scheduler then S is serializable Proof Assume T i T j in P(S) conflicting p i [X], q j [X] in S: p i [X] < S q j [X] ts(t i ) < ts(t j ) by TO rule CS 347 Notes 5 48
49 TO Scheduler Assume there is a cycle T 1 T 2... T n T 1 in P(S) ts(t 1 ) < ts(t 2 ) < < ts(t n ) < ts (T 1 ), which is a contradiction Hence, P(S) is acyclic S is serializable CS 347 Notes 5 49
50 Thomas Write Rule mtsr[x] mtsw[x] ts(t i ) T i wants to write X CS 347 Notes 5 50
51 Thomas Write Rule w i [X] arrives if ts(t i ) < mtsr[x] then abort T i else if ts(t i ) < mtsw[x] ignore write else // as before CS 347 Notes 5 51
52 Thomas Write Rule mtsr[x] ts(t i ) T i wants to write X mtsw[x] Why can t we let T i go ahead? CS 347 Notes 5 52
53 Thomas Write Rule T j reads X mtsr[x] ts(t i ) T i wants to write X mtsw[x] Why can t we let T i go ahead? mtsr[x] is only the latest read there could be others before CS 347 Notes 5 53
54 TO Optimizations Update mtsr and mtsw when the action is executed, not when it is added to the queue mtsw[x] = 9 or 7? X ts = 9 ts = 8 ts = 7 active write CS 347 Notes 5 54
55 TO Optimizations Use multiple versions of data X Value ts = 9 r i [X] ts(t i ) = 8 Value ts = 7 CS 347 Notes 5 55
56 Timestamp Management X 1 X 2 data mtsr mtsw X n Tons of space and extra IO CS 347 Notes 5 56
57 Timestamp Management Timestamp cache min item mtsr mtsw X Y Z If transaction reads/writes X, add/update entry for X in cache Periodically purge items X with mtsr[x] < min, mtsw[x] < min Track min (e.g., choose min current time d) CS 347 Notes 5 57
58 Timestamp Management Timestamp cache Enforcing TO rule for p i [X]: if X has entry in cache then use mtsr, mtsw values in cache else assume mtsr[x] = mtsw[x] = min Use hashing (on items) for cache CS 347 Notes 5 58
59 2PL TO T 1 w 1 [ Y ] T 2 r 2 [ X ] r 2 [ Y ] w 2 [ Z ] ts(t 1 ) < ts(t 2 ) < ts(t 3 ) T 3 w 3 [ X ] S r 2 [ X ] w 3 [ X ] w 1 [ Y ] r 2 [ Y ] w 2 [ Z ] S could be produced with TO but not with 2PL CS 347 Notes 5 59
60 2PL TO Are all 2PL schedules TO? any examples here? TO schedules 2PL schedules previous example CS 347 Notes 5 60
61 Distributed TO Scheduler scheduler 1 D 1 D 1 ts cache node 1... scheduler 2 D 2 D 2 ts cache node 2 CS 347 Notes 5 61
62 Distributed TO Scheduler scheduler 1 D 1 D 1 ts cache node 1... scheduler 2 D 2 D 2 ts cache node 2 access data T access data Each scheduler is independent Signal all schedulers involved at the end of the transaction CS 347 Notes 5 62
63 Pessimistic vs. Optimistic Control Pessimistic validate read (compute) write Optimistic read (compute) validate write CS 347 Notes 5 63
64 Pessimistic vs. Optimistic Control Optimistic control enables more parallelism T 1 R V W T 2 R V W T 1 R V W T 2 R V W T 1 R V W T 2 R V W CS 347 Notes 5 64
65 Summary 2PL Useful in a distributed system Most popular Deadlocks still possible TO Useful in a distributed system Aborts more likely No deadlocks CS 347 Notes 5 65
CS 347 Parallel and Distributed Data Processing
CS 347 Parallel and Distributed Data Processing Spring 2016 Notes 5: Concurrency Control Topics Data Database design Queries Decomposition Localization Optimization Transactions Concurrency control Reliability
More informationConcurrency control in Homogeneous Distributed Databases (2)
Concurrency control in Homogeneous Distributed Databases (2) Timestamp ordering Basic implementation Optimistic CC in distributed DB Distributed deadlock detection based on slides by Weikum / Vossen: Transactional
More informationDistributed Databases
Topics for the day Distributed Databases CS347 Lecture 15 June 4, 2001 Concurrency Control Schedules and Serializability Locking Timestamp control Reliability Failure models Twophase protocol 1 2 Example
More informationTransaction Processing Concurrency control
Transaction Processing Concurrency control Hans Philippi March 14, 2017 Transaction Processing: Concurrency control 1 / 24 Transactions Transaction Processing: Concurrency control 2 / 24 Transaction concept
More informationImplementing Isolation
CMPUT 391 Database Management Systems Implementing Isolation Textbook: 20 & 21.1 (first edition: 23 & 24.1) University of Alberta 1 Isolation Serial execution: Since each transaction is consistent and
More informationConcurrency. Consider two ATMs running in parallel. We need a concurrency manager. r1[x] x:=x-250 r2[x] x:=x-250 w[x] commit w[x] commit
DBMS ARCHITECTURE Concurrency Consider two ATMs running in parallel T1 T2 r1[x] x:=x-250 r2[x] x:=x-250 w[x] commit w[x] commit We need a concurrency manager Examples of interference T1: r[x=100] w[x:=600]
More informationCS54200: Distributed Database Systems
CS54200: Distributed Database Systems Timestamp Ordering 28 January 2009 Prof. Chris Clifton Timestamp Ordering The key idea for serializability is to ensure that conflicting operations are not executed
More informationConcurrency Control 9-1
Concurrency Control The problem of synchronizing concurrent transactions such that the consistency of the database is maintained while, at the same time, maximum degree of concurrency is achieved. Principles:
More informationMulti-User-Synchronization
Chapter 10 Multi-User-Synchronization Database Systems p. 415/569 Why Run TAs Concurrently? We could run all TAs serially (one after the other) This would prevent all unwanted side effects However, this
More informationTRANSACTION MANAGEMENT
TRANSACTION MANAGEMENT CS 564- Spring 2018 ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Transaction (TXN) management ACID properties atomicity consistency isolation durability
More informationTransactions and Concurrency Control
Transactions and Concurrency Control Computer Science E-66 Harvard University David G. Sullivan, Ph.D. Overview A transaction is a sequence of operations that is treated as a single logical operation.
More informationDatabase Tuning and Physical Design: Execution of Transactions
Database Tuning and Physical Design: Execution of Transactions Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Transaction Execution 1 / 20 Basics
More informationLecture 22 Concurrency Control Part 2
CMSC 461, Database Management Systems Spring 2018 Lecture 22 Concurrency Control Part 2 These slides are based on Database System Concepts 6 th edition book (whereas some quotes and figures are used from
More informationChapter 9: Concurrency Control
Chapter 9: Concurrency Control Concurrency, Conflicts, and Schedules Locking Based Algorithms Timestamp Ordering Algorithms Deadlock Management Acknowledgements: I am indebted to Arturas Mazeika for providing
More informationDistributed Transaction Management
Distributed Transaction Management Material from: Principles of Distributed Database Systems Özsu, M. Tamer, Valduriez, Patrick, 3rd ed. 2011 + Presented by C. Roncancio Distributed DBMS M. T. Özsu & P.
More informationCSC 261/461 Database Systems Lecture 21 and 22. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101
CSC 261/461 Database Systems Lecture 21 and 22 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Announcements Project 3 (MongoDB): Due on: 04/12 Work on Term Project and Project 1 The last (mini)
More informationFor more Articles Go To: Whatisdbms.com CONCURRENCY CONTROL PROTOCOL
For more Articles Go To: Whatisdbms.com CONCURRENCY CONTROL PROTOCOL In the multi-user system, we all know that multiple transactions run in parallel, thus trying to access the same data and suppose if
More informationTime stamp ordering. 5 Non-locking concurrency Control
5 Non-locking concurrency Control 51 Timestamp ordering 52 Basic implementation 53 Optimistic CC in centralized and distributed systems Time stamp ordering Basic idea: - assign timestamp ts(t) when transaction
More informationIntro to Transactions
Reading Material CompSci 516 Database Systems Lecture 14 Intro to Transactions [RG] Chapter 16.1-16.3, 16.4.1 17.1-17.4 17.5.1, 17.5.3 Instructor: Sudeepa Roy Acknowledgement: The following slides have
More informationConcurrency Control! Snapshot isolation" q How to ensure serializability and recoverability? " q Lock-Based Protocols" q Other Protocols"
Concurrency Control! q How to ensure serializability and recoverability? q Lock-Based Protocols q Lock, 2PL q Lock Conversion q Lock Implementation q Deadlock q Multiple Granularity q Other Protocols q
More informationChapter 5. Concurrency Control Techniques. Adapted from the slides of Fundamentals of Database Systems (Elmasri et al., 2006)
Chapter 5 Concurrency Control Techniques Adapted from the slides of Fundamentals of Database Systems (Elmasri et al., 2006) Chapter Outline Purpose of Concurrency Control Two-Phase Locking Techniques Concurrency
More informationConcurrency Control. Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules
Concurrency Control Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules How? transaction operations interleaved following a protocol
More informationTransaction Management and Concurrency Control. Chapter 16, 17
Transaction Management and Concurrency Control Chapter 16, 17 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh
More informationTransactions. Concurrency. Consistency ACID. Modeling transactions. Transactions and Concurrency Control
COS 597D: Principles of Database and Information Systems Transactions and Concurrency Control Transactions Unit of update/change Viewed as indivisible Database can be inconsistent during transaction Add
More informationConcurrency Control. Transaction Management. Lost Update Problem. Need for Concurrency Control. Concurrency control
Concurrency Control Process of managing simultaneous operations on the database without having them interfere with one another. Transaction Management Concurrency control Connolly & Begg. Chapter 19. Third
More informationCSC 261/461 Database Systems Lecture 24
CSC 261/461 Database Systems Lecture 24 Fall 2017 TRANSACTIONS Announcement Poster: You should have sent us the poster by yesterday. If you have not done so, please send us asap. Make sure to send it for
More informationPage 1. Goals of Today s Lecture. The ACID properties of Transactions. Transactions
Goals of Today s Lecture CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC) Finish Transaction scheduling Two phase locking (2PL) and
More informationTransaction Processing: Concurrency Control ACID. Transaction in SQL. CPS 216 Advanced Database Systems. (Implicit beginning of transaction)
Transaction Processing: Concurrency Control CPS 216 Advanced Database Systems ACID Atomicity Transactions are either done or not done They are never left partially executed Consistency Transactions should
More informationComp 5311 Database Management Systems. 14. Timestamp-based Protocols
Comp 5311 Database Management Systems 14. Timestamp-based Protocols 1 Timestamps Each transaction is issued a timestamp when it enters the system. If an old transaction T i has time-stamp TS(T i ), a new
More informationDatenbanksysteme II: Implementation of Database Systems Synchronization of Concurrent Transactions
Datenbanksysteme II: Implementation of Database Systems Synchronization of Concurrent Transactions Material von Prof. Johann Christoph Freytag Prof. Kai-Uwe Sattler Prof. Alfons Kemper, Dr. Eickler Prof.
More informationCopyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 18-1
Slide 18-1 Chapter 18 Concurrency Control Techniques Chapter 18 Outline Databases Concurrency Control 1. Purpose of Concurrency Control 2. Two-Phase locking 3. Limitations of CCMs 4. Index Locking 5. Lock
More informationCSIT5300: Advanced Database Systems
CSIT5300: Advanced Database Systems L12: Timestamp-based Protocols Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR, China
More information3. Concurrency Control for Transactions Part One
3. Concurrency Control for Transactions Part One CSEP 545 Transaction Processing Philip A. Bernstein Copyright 2012 Philip A. Bernstein 1/11/2012 1 Outline 1. A Simple System Model 2. Serializability Theory
More informationChapter 13 : Concurrency Control
Chapter 13 : Concurrency Control Chapter 13: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Insert and Delete Operations
More informationDistributed Databases Systems
Distributed Databases Systems Lecture No. 07 Concurrency Control Naeem Ahmed Email: naeemmahoto@gmail.com Department of Software Engineering Mehran Univeristy of Engineering and Technology Jamshoro Outline
More informationPart III Transactions
Part III Transactions Transactions Example Transaction: Transfer amount X from A to B debit(account A; Amount X): A = A X; credit(account B; Amount X): B = B + X; Either do the whole thing or nothing ACID
More informationChapter 15 : Concurrency Control
Chapter 15 : Concurrency Control What is concurrency? Multiple 'pieces of code' accessing the same data at the same time Key issue in multi-processor systems (i.e. most computers today) Key issue for parallel
More informationChapter 18 Concurrency Control Techniques
Chapter 18 Concurrency Control Techniques Copyright 2004 Pearson Education, Inc. Chapter 18 Outline Databases Concurrency Control 1 Purpose of Concurrency Control 2 Two-Phase locking 5 Limitations of CCMs
More informationThe Issue. Implementing Isolation. Transaction Schedule. Isolation. Schedule. Schedule
The Issue Implementing Isolation Chapter 20 Maintaining database correctness when many transactions are accessing the database concurrently Assuming each transaction maintains database correctness when
More informationConcurrency Control. Chapter 17. Comp 521 Files and Databases Spring
Concurrency Control Chapter 17 Comp 521 Files and Databases Spring 2010 1 Conflict Serializable Schedules Recall conflicts (WW, RW, WW) were the cause of sequential inconsistency Two schedules are conflict
More informationDatabase Management Systems
Database Management Systems Concurrency Control Doug Shook Review Why do we need transactions? What does a transaction contain? What are the four properties of a transaction? What is a schedule? What is
More informationDatabase Technology. Topic 9: Concurrency Control
Topic 9: Concurrency Control Olaf Hartig olaf.hartig@liu.se Goal Preserve Isolation of the ACID properties 2 Notation and Initial Concepts Transaction Notation Focus on read and write operations For instance,
More informationSynchronization. Clock Synchronization
Synchronization Clock Synchronization Logical clocks Global state Election algorithms Mutual exclusion Distributed transactions 1 Clock Synchronization Time is counted based on tick Time judged by query
More information! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes :
Lock-Based Protocols Concurrency Control! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes : 1 exclusive (X) mode Data item can be both read as well
More informationConcurrency Control in Distributed Systems. ECE 677 University of Arizona
Concurrency Control in Distributed Systems ECE 677 University of Arizona Agenda What? Why? Main problems Techniques Two-phase locking Time stamping method Optimistic Concurrency Control 2 Why concurrency
More informationChapter 6 Distributed Concurrency Control
Chapter 6 Distributed Concurrency Control Table of Contents Serializability Theory Taxonomy of Concurrency Control Algorithms Locking-Based Concurrency Control Timestamp-Based Concurrency Control Optimistic
More informationMultiversion Schemes to achieve Snapshot Isolation Timestamped Based Protocols
Multiversion Schemes to achieve Snapshot Isolation Timestamped Based Protocols Database System Concepts 5 th Ed. Silberschatz, Korth and Sudarshan, 2005 See www.db-book.com for conditions on re-use Each
More informationCS 370 Concurrency worksheet. T1:R(X); T2:W(Y); T3:R(X); T2:R(X); T2:R(Z); T2:Commit; T3:W(X); T3:Commit; T1:W(Y); Commit
CS 370 Concurrency worksheet Name Student ID 1) Apply the appropriate locks and show the resulting schedule for the following sequence of operations using strict 2PL. Assume locks can be upgraded. :R(X);
More informationTransaction Management. Pearson Education Limited 1995, 2005
Chapter 20 Transaction Management 1 Chapter 20 - Objectives Function and importance of transactions. Properties of transactions. Concurrency Control Deadlock and how it can be resolved. Granularity of
More informationTransactional Information Systems:
Transactional Information Systems: Theory, Algorithms, and the Practice of Concurrency Control and Recovery Gerhard Weikum and Gottfried Vossen 2002 Morgan Kaufmann ISBN 1-55860-508-8 Teamwork is essential.
More informationConcurrency Control. [R&G] Chapter 17 CS432 1
Concurrency Control [R&G] Chapter 17 CS432 1 Conflict Serializable Schedules Two schedules are conflict equivalent if: Involve the same actions of the same transactions Every pair of conflicting actions
More informationCMSC 461 Final Exam Study Guide
CMSC 461 Final Exam Study Guide Study Guide Key Symbol Significance * High likelihood it will be on the final + Expected to have deep knowledge of can convey knowledge by working through an example problem
More informationTransaction Processing: Basics - Transactions
Transaction Processing: Basics - Transactions Transaction is execution of program that accesses DB Basic operations: 1. read item(x): Read DB item X into program variable 2. write item(x): Write program
More informationConcurrency Control Techniques
Concurrency Control Techniques Chapter 18 March 24, 2008 ADBS: Concurrency control 1 Chapter Objectives Discusses a number of concurrency control techniques that are used to insure the noninterference
More informationReview. Review. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Lecture #21: Concurrency Control (R&G ch.
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #21: Concurrency Control (R&G ch. 17) Review DBMSs support ACID Transaction semantics. Concurrency control and Crash
More informationTransaction Management: Concurrency Control
Transaction Management: Concurrency Control Yanlei Diao Slides Courtesy of R. Ramakrishnan and J. Gehrke DBMS Architecture Query Parser Query Rewriter Query Optimizer Query Executor Lock Manager Concurrency
More informationConcurrency control 12/1/17
Concurrency control 12/1/17 Bag of words... Isolation Linearizability Consistency Strict serializability Durability Snapshot isolation Conflict equivalence Serializability Atomicity Optimistic concurrency
More informationConcurrency Control. Chapter 17. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1
Concurrency Control Chapter 17 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Conflict Schedules Two actions conflict if they operate on the same data object and at least one of them
More information) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)
) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons) Transactions - Definition A transaction is a sequence of data operations with the following properties: * A Atomic All
More informationGoal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3
Goal of Concurrency Control Concurrency Control Transactions should be executed so that it is as though they executed in some serial order Also called Isolation or Serializability Weaker variants also
More informationSynchronization Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University
Synchronization Part II CS403/534 Distributed Systems Erkay Savas Sabanci University 1 Election Algorithms Issue: Many distributed algorithms require that one process act as a coordinator (initiator, etc).
More informationTransaction Processing: Concurrency Control. Announcements (April 26) Transactions. CPS 216 Advanced Database Systems
Transaction Processing: Concurrency Control CPS 216 Advanced Database Systems Announcements (April 26) 2 Homework #4 due this Thursday (April 28) Sample solution will be available on Thursday Project demo
More informationCarnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class. Last Class. Faloutsos/Pavlo CMU /615
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications C. Faloutsos A. Pavlo Lecture#21: Concurrency Control (R&G ch. 17) Last Class Introduction to Transactions ACID Concurrency
More informationLecture 21. Lecture 21: Concurrency & Locking
Lecture 21 Lecture 21: Concurrency & Locking Lecture 21 Today s Lecture 1. Concurrency, scheduling & anomalies 2. Locking: 2PL, conflict serializability, deadlock detection 2 Lecture 21 > Section 1 1.
More informationA lock is a mechanism to control concurrent access to a data item Data items can be locked in two modes:
Concurrency Control Concurrency Control Lock-Based and Tree-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Insert and Delete Operations Concurrency
More informationConcurrency Control. Chapter 17. Comp 521 Files and Databases Fall
Concurrency Control Chapter 17 Comp 521 Files and Databases Fall 2012 1 Conflict Serializable Schedules Recall conflicts (WR, RW, WW) were the cause of sequential inconsistency Two schedules are conflict
More informationExercises on Concurrency Control (part 2)
Exercises on Concurrency Control (part 2) Maurizio Lenzerini Dipartimento di Informatica e Sistemistica Antonio Ruberti Università di Roma La Sapienza Anno Accademico 2017/2018 http://www.dis.uniroma1.it/~lenzerin/index.html/?q=node/53
More informationtransaction - (another def) - the execution of a program that accesses or changes the contents of the database
Chapter 19-21 - Transaction Processing Concepts transaction - logical unit of database processing - becomes interesting only with multiprogramming - multiuser database - more than one transaction executing
More informationConcurrency Control CHAPTER 17 SINA MERAJI
Concurrency Control CHAPTER 17 SINA MERAJI Announcement Sign up for final project presentations here: https://docs.google.com/spreadsheets/d/1gspkvcdn4an3j3jgtvduaqm _x4yzsh_jxhegk38-n3k/edit#gid=0 Deadline
More informationConcurrency Control. Conflict Serializable Schedules. Example. Chapter 17
Concurrency Control Chapter 17 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Conflict Serializable Schedules Two schedules are conflict equivalent if: Involve the same actions of the
More information230 Chapter 17. (c) Otherwise, T writes O and WTS(O) is set to TS(T).
230 Chapter 17 (c) Otherwise, T writes O and WTS(O) is set to TS(T). The justification is as follows: had TS(T )
More information0: BEGIN TRANSACTION 1: W = 1 2: X = W + 1 3: Y = X * 2 4: COMMIT TRANSACTION
Transactions 1. a) Show how atomicity is maintained using a write-ahead log if the system crashes when executing statement 3. Main memory is small, and can only hold 2 variables at a time. Initially, all
More informationSynchronization. Chapter 5
Synchronization Chapter 5 Clock Synchronization In a centralized system time is unambiguous. (each computer has its own clock) In a distributed system achieving agreement on time is not trivial. (it is
More informationDB2 Lecture 10 Concurrency Control
DB2 Lecture 10 Control Jacob Aae Mikkelsen November 28, 2012 1 / 71 Jacob Aae Mikkelsen DB2 Lecture 10 Control ACID Properties Properly implemented transactions are commonly said to meet the ACID test,
More informationControl. CS432: Distributed Systems Spring 2017
Transactions and Concurrency Control Reading Chapter 16, 17 (17.2,17.4,17.5 ) [Coulouris 11] Chapter 12 [Ozsu 10] 2 Objectives Learn about the following: Transactions in distributed systems Techniques
More informationA can be implemented as a separate process to which transactions send lock and unlock requests The lock manager replies to a lock request by sending a lock grant messages (or a message asking the transaction
More informationTransaction in Distributed Databases
Transaction in Distributed Databases An Application view Example: Planning a conference trip / Budget:=1000; Trials:=1; ConfFee Go Select Conference Select Tutorials Compute Fee [Cost Budget] What ist
More informationPage 1. Goals of Todayʼs Lecture" Two Key Questions" Goals of Transaction Scheduling"
Goals of Todayʼs Lecture" CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC)" Transaction scheduling Two phase locking (2PL) and strict
More informationT ransaction Management 4/23/2018 1
T ransaction Management 4/23/2018 1 Air-line Reservation 10 available seats vs 15 travel agents. How do you design a robust and fair reservation system? Do not enough resources Fair policy to every body
More informationConcurrent & Distributed Systems Supervision Exercises
Concurrent & Distributed Systems Supervision Exercises Stephen Kell Stephen.Kell@cl.cam.ac.uk November 9, 2009 These exercises are intended to cover all the main points of understanding in the lecture
More informationPage 1. Goals of Today s Lecture" Two Key Questions" Goals of Transaction Scheduling"
Goals of Today s Lecture" CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC)" Transaction scheduling Two phase locking (2PL) and strict
More informationLock-based concurrency control. Q: What if access patterns rarely, if ever, conflict? Serializability. Concurrency Control II (OCC, MVCC)
Concurrency Control II (CC, MVCC) CS 418: Distributed Systems Lecture 18 Serializability Execution of a set of transactions over multiple items is equivalent to some serial execution of s Michael Freedman
More informationDatenbanksysteme II: Synchronization of Concurrent Transactions. Ulf Leser
Datenbanksysteme II: Synchronization of Concurrent Transactions Ulf Leser Content of this Lecture Synchronization Serial and Serializable Schedules Locking and Deadlocks Timestamp Synchronization and SQL
More informationOptimistic Concurrency Control. April 18, 2018
Optimistic Concurrency Control April 18, 2018 1 Serializability Executing transactions serially wastes resources Interleaving transactions creates correctness errors Give transactions the illusion of isolation
More informationGraph-based protocols are an alternative to two-phase locking Impose a partial ordering on the set D = {d 1, d 2,..., d h } of all data items.
Graph-based protocols are an alternative to two-phase locking Impose a partial ordering on the set D = {d 1, d 2,..., d h } of all data items. If d i d j then any transaction accessing both d i and d j
More informationConcurrency Control & Recovery
Transaction Management Overview CS 186, Fall 2002, Lecture 23 R & G Chapter 18 There are three side effects of acid. Enhanced long term memory, decreased short term memory, and I forget the third. - Timothy
More informationLecture 21 Concurrency Control Part 1
CMSC 461, Database Management Systems Spring 2018 Lecture 21 Concurrency Control Part 1 These slides are based on Database System Concepts 6 th edition book (whereas some quotes and figures are used from
More informationCS 541 Database Systems. Two Phase Locking 2
CS 541 Database Systems Two Phase Locking 2 Phantoms Consider a banking application with two files: Accounts (number, location, balance); and Assets (branch, total). Two txns: T 1 checks total for some
More informationCS 5300 module6. Problem #1 (10 Points) a) Consider the three transactions T1, T2, and T3, and the schedules S1 and S2.
Name CS 5300 module6 Student ID Problem #1 (10 Points) a) Consider the three transactions T1, T2, and T3, and the schedules S1 and S2. T1: r1(x); r1(z); w1(x); T2: r2(y); r2(z); w2(y); T3: w3(x); r3(y);
More informationWhat are Transactions? Transaction Management: Introduction (Chap. 16) Major Example: the web app. Concurrent Execution. Web app in execution (CS636)
What are Transactions? Transaction Management: Introduction (Chap. 16) CS634 Class 14, Mar. 23, 2016 So far, we looked at individual queries; in practice, a task consists of a sequence of actions E.g.,
More informationDistributed Systems (ICE 601) Transactions & Concurrency Control - Part1
Distributed Systems (ICE 601) Transactions & Concurrency Control - Part1 Dongman Lee ICU Class Overview Transactions Why Concurrency Control Concurrency Control Protocols pessimistic optimistic time-based
More informationFoundation of Database Transaction Processing. Copyright 2012 Pearson Education, Inc.
Foundation of Database Transaction Processing Copyright 2012 Pearson Education, Inc. Chapter Outline - 17.1 Introduction to Transaction Processing - 17.2 Transaction and System Concepts - 17.3 Desirable
More informationTransaction Management: Introduction (Chap. 16)
Transaction Management: Introduction (Chap. 16) CS634 Class 14 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke What are Transactions? So far, we looked at individual queries;
More informationExam 2 Review. Fall 2011
Exam 2 Review Fall 2011 Question 1 What is a drawback of the token ring election algorithm? Bad question! Token ring mutex vs. Ring election! Ring election: multiple concurrent elections message size grows
More informationConcurrency Control. R &G - Chapter 19
Concurrency Control R &G - Chapter 19 Smile, it is the key that fits the lock of everybody's heart. Anthony J. D'Angelo, The College Blue Book Review DBMSs support concurrency, crash recovery with: ACID
More informationAtomic Transac1ons. Atomic Transactions. Q1: What if network fails before deposit? Q2: What if sequence is interrupted by another sequence?
CPSC-4/6: Operang Systems Atomic Transactions The Transaction Model / Primitives Serializability Implementation Serialization Graphs 2-Phase Locking Optimistic Concurrency Control Transactional Memory
More informationConcurrency control CS 417. Distributed Systems CS 417
Concurrency control CS 417 Distributed Systems CS 417 1 Schedules Transactions must have scheduled so that data is serially equivalent Use mutual exclusion to ensure that only one transaction executes
More informationMobile and Heterogeneous databases Distributed Database System Transaction Management. A.R. Hurson Computer Science Missouri Science & Technology
Mobile and Heterogeneous databases Distributed Database System Transaction Management A.R. Hurson Computer Science Missouri Science & Technology 1 Distributed Database System Note, this unit will be covered
More informationTransactions: Definition. Concurrent transactions: Problems
1 Transactions: Definition Transactions: Read/Write Model Transactional properties of DBS Transaction Concepts Concurrency control Important concept Transaction (TA) Unit of work consisting of a sequence
More informationConcurrency Control / Serializability Theory
Concurrency Control / Serializability Theory Correctness of a program can be characterized by invariants Invariants over state Linked list: For all items I where I.prev!= NULL: I.prev.next == I For all
More information