Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.

Slides:



Advertisements
Similar presentations
Database System Concepts 5 th Ed. © Silberschatz, Korth and Sudarshan, 2005 See for conditions on re-usewww.db-book.com Chapter 16 : Concurrency.
Advertisements

Database Systems (資料庫系統)
Chapter 16 Concurrency. Topics in this Chapter Three Concurrency Problems Locking Deadlock Serializability Isolation Levels Intent Locking Dropping ACID.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
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 Enforcing Serializability by Locks
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
Concurrency Control II. General Overview Relational model - SQL  Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
©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.
Transaction Management and Concurrency Control
14/06/2015Distribuerede Systemer1 Concurrency Control Thomas Hildebrandt.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Transaction Management
ICS (072)Concurrency Control1 Transaction Processing and Concurrency Control Dr. Muhammad Shafique Chapter March 2008.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transactions and concurrency control
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
ICS (072)Concurrency Control Techniques1 Concurrency Control Techniques Chapter 18 Dr. Muhammad Shafique.
Concurrency Control Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Chapter 11 Concurrency Control. Lock-Based Protocols  A lock is a mechanism to control concurrent access to a data item  Data items can be locked in.
Concurrency Control Techniques Chapter 18
Concurrency control. Lock-based protocols One way to ensure serializability is to require the data items be accessed in a mutually exclusive manner One.
Chapter 15 Concurrency Control Yonsei University 1 st Semester, 2015 Sanghyun Park.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Distributed synchronization and mutual exclusion Distributed Transactions.
Chapter 16 Concurrency. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.16-2 Topics in this Chapter Three Concurrency Problems Locking Deadlock.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Concurrency Chapter 6.2 V3.1 Napier University Dr Gordon Russell.
Concurrency Control Introduction Lock-Based Protocols
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
Timestamp-based Concurrency Control
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
Lecture 9- Concurrency Control (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Em Spatiotemporal Database Laboratory Pusan National University File Processing : Concurrency Control 2004, Spring Pusan National University Ki-Joune Li.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
10 Transaction Management and Concurrency Control MIS 304 Winter 2005.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Concurrency Control Techniques
Transaction Management and Concurrency Control
Concurrency Control II (OCC, MVCC)
Concurrency.
Chapter 10 Transaction Management and Concurrency Control
Chapter 15 : Concurrency Control
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
CSE 486/586 Distributed Systems Concurrency Control --- 2
ENFORCING SERIALIZABILITY BY LOCKS
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Database Management System
Submitted to Dr. Badie Sartawi Submitted by Nizar Handal Course
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
Concurrency control (OCC and MVCC)
Database Systems (資料庫系統)
Database Systems (資料庫系統)
Presentation transcript:

Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.

Page 2 Schedules Transactions must have scheduled so that data is serially equivalent Use mutual exclusion to ensure that only one transaction executes at a time or… Allow multiple transactions to execute concurrently –but ensure serializability concurrency control schedule: valid order of interleaving

Page 3 Locking Serialize with exclusive locks on a resource –lock data that is used by the transaction –lock manager Conflicting operations of two transactions must be executed in the same order –transaction not allowed new locks after it has released a lock Two-phase locking –phase 1: growing phase: acquire locks –phase 2: shrinking phase: release locks

Page 4 Strict two-phase locking If a transaction aborts –any other transactions that have accessed data from released locks (uncommitted data) have to be aborted –cascading aborts Avoid this situation: –transaction holds all locks until it commits or aborts strict two-phase locking

Page 5 Locking granularity Typically there will be many objects in a system –a typical transaction will access only a few of them (and is unlikely to clash with other transactions) Granularity of locking affects concurrency –smaller amount locked  higher concurrency

Page 6 Multiple readers/single writer Improve concurrency by supporting multiple readers –there is no problem with multiple transactions reading data from the same object –only one transaction should be able to write to an object … and no other transactions should read in this case

Page 7 Multiple readers/single writer Two locks: read locks and write locks –set a read lock before doing a read on an object –set a write lock before doing a write on an object –block (wait) if transaction cannot get the lock If a transaction has: –no locks for an object: another transaction may obtain a read or write lock –a read lock for an object: another transaction may obtain a read but wait for write lock –a write lock for an object: another transaction will have to wait for a read or a write lock

Page 8 Increasing concurrency: two-version locking Transaction can write tentative versions of objects –others read from the committed (original) version Read operations wait if another transaction is committing the same object Allows for more concurrency than read-write locks –writing transactions risk waiting or rejection when they attempt to commit –transactions cannot commit if other uncompleted transactions have read the objects –these transactions must wait until the reading transactions have committed

Page 9 Two-version locking Three types of locks: –read lock, write lock, commit lock Transaction cannot get a read or write lock if there is a commit lock

Page 10 Two-version locking When the transaction coordinator receives a request to commit: –converts all that transaction’s write locks into commit locks –If any objects have outstanding read locks, transaction must wait until the transactions that set these locks have completed and locks are released Compare with read/write locks: –read operations delayed only while transactions are committed –read operations of one transaction can cause delay in the committing of other transactions

Page 11 Problems with locking Locks have an overhead: maintenance, checking Locks can result in deadlock Locks may reduce concurrency by having transactions hold the locks until the transaction commits (strict two-phase locking)

Page 12 Optimistic concurrency control In most applications the chance of two transactions accessing the same object is low Allow transactions to proceed without obtaining locks Check for conflicts at commit time –if there is a conflict abort and restart some transaction Phases: –working phase –validation phase –update phase

Page 13 Timestamp ordering Assign unique timestamp to a transaction when it begins Each object has a read and write timestamp associated with it –which committed transaction last read the object –which committed transaction last wrote the object Good ordering: –object’s read and write timestamps will be older than current transaction if it wants to write an object –object’s write timestamps will be older than current transaction if it wants to read an object Abort and restart transaction for improper ordering

Page 14 The end.