Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Distributed synchronization and mutual exclusion Distributed Transactions.

Slides:



Advertisements
Similar presentations
CM20145 Concurrency Control
Advertisements

Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Database Systems (資料庫系統)
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.
Concurrency Control II
Concurrency Control Enforcing Serializability by Locks
1 CS 194: Elections, Exclusion and Transactions Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
Quick Review of Apr 29 material
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Today: –Introduction –Consistency models Data-centric consistency.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Distributed Systems1 Chapter 7: Distributed Transactions Transaction concepts Centralized/Distributed Transaction Architecture Schedule concepts Locking.
Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
Session - 13 CONCURRENCY CONTROL CONCURRENCY TECHNIQUE Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
Synchronization Chapter 5.
Transaction Management
Computer Science Lecture 14, page 1 CS677: Distributed OS Consistency and Replication Introduction Consistency models –Data-centric consistency models.
Synchronization Chapter 5. Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Concurrency Control in Distributed Databases
© 1997 UW CSE 11/13/97N-1 Concurrency Control Chapter 18.1, 18.2, 18.5, 18.7.
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari.
Concurrency Control in Distributed Databases. By :- Rishikesh Mandvikar rmandvik[at]engr.smu.edu May 1, 2004.
Consistency and Replication CSCI 4780/6780. Chapter Outline Why replication? –Relations to reliability and scalability How to maintain consistency of.
Solution to Dining Philosophers. Each philosopher I invokes the operations pickup() and putdown() in the following sequence: dp.pickup(i) EAT dp.putdown(i)
Real-Time & MultiMedia Lab Synchronization Chapter 5.
1 Mutual Exclusion: A Centralized Algorithm a)Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b)Process.
Concurrency Control Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
Synchronization Chapter 5. Outline 1.Clock synchronization 2.Logical clocks 3.Global state 4.Election algorithms 5.Mutual exclusion 6.Distributed transactions.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two schedules are conflict equivalent if:  Involve the same actions of the same.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
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.
7c.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Module 7c: Atomicity Atomic Transactions Log-based Recovery Checkpoints Concurrent.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Concurrency Control Introduction Lock-Based Protocols
1 Concurrency control lock-base protocols timestamp-based protocols validation-based protocols Ioan Despi.
Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time.
1 Database Systems ( 資料庫系統 ) December 27, 2004 Chapter 17 By Hao-hua Chu ( 朱浩華 )
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.
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Synchronization Chapter 5. Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned.
1 Concurrency Control By Ankit Patel. 2 INTRODUCTION Enforcing serializability by locks Locks Locking scheduler Two phase locking Locking systems with.
Lecture on Synchronization Submitted by
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Transactions Examples
CS6320 – Performance L. Grewe.
Transaction Management
Last Class: Canonical Problems
Concurrency Control via Validation
EECS 498 Introduction to Distributed Systems Fall 2017
Outline Introduction Background Distributed DBMS Architecture
Concurrency Control II (OCC, MVCC)
Chapter 10 Transaction Management and Concurrency Control
Concurrency Control Chapter 17
Consistency and Replication
Distributed Database Management Systems
ENFORCING SERIALIZABILITY BY LOCKS
Concurrency Control Chapter 17
Chapter 7: Distributed Transactions
Concurrency control (OCC and MVCC)
Transactions, Properties of Transactions
Presentation transcript:

Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Distributed synchronization and mutual exclusion Distributed Transactions

Computer Science Lecture 13, page 2 CS677: Distributed OS Today: Concurrency Control Concurrency control –Two phase locks –Time stamps Intro to Replication and Consistency Thoughts on the mid-term

Computer Science Lecture 13, page 3 CS677: Distributed OS Concurrency Control Goal: Allow several transactions to be executing simultaneously such that –Collection of manipulated data item is left in a consistent state Achieve consistency by ensuring data items are accessed in an specific order –Final result should be same as if each transaction ran sequentially Concurrency control can implemented in a layered fashion

Computer Science Lecture 13, page 4 CS677: Distributed OS Concurrency Control Implementation General organization of managers for handling transactions.

Computer Science Lecture 13, page 5 CS677: Distributed OS Distributed Concurrency Control General organization of managers for handling distributed transactions.

Computer Science Lecture 13, page 6 CS677: Distributed OS Serializability Key idea: properly schedule conflicting operations Conflict possible if at least one operation is write –Read-write conflict –Write-write conflict BEGIN_TRANSACTION x = 0; x = x + 1; END_TRANSACTION (a) BEGIN_TRANSACTION x = 0; x = x + 2; END_TRANSACTION (b) BEGIN_TRANSACTION x = 0; x = x + 3; END_TRANSACTION (c) Schedule 1x = 0; x = x + 1; x = 0; x = x + 2; x = 0; x = x + 3Legal Schedule 2x = 0; x = 0; x = x + 1; x = x + 2; x = 0; x = x + 3;Legal Schedule 3x = 0; x = 0; x = x + 1; x = 0; x = x + 2; x = x + 3;Illegal

Computer Science Lecture 13, page 7 CS677: Distributed OS Optimistic Concurrency Control Transaction does what it wants and validates changes prior to commit –Check if files/objects have been changed by committed transactions since they were opened –Insight: conflicts are rare, so works well most of the time Works well with private workspaces Advantage: –Deadlock free –Maximum parallelism Disadvantage: –Rerun transaction if aborts –Probability of conflict rises substantially at high loads Not used widely

Computer Science Lecture 13, page 8 CS677: Distributed OS Two-phase Locking Widely used concurrency control technique Scheduler acquires all necessary locks in growing phase, releases locks in shrinking phase –Check if operation on data item x conflicts with existing locks If so, delay transaction. If not, grant a lock on x –Never release a lock until data manager finishes operation on x –One a lock is released, no further locks can be granted Problem: deadlock possible –Example: acquiring two locks in different order Distributed 2PL versus centralized 2PL

Computer Science Lecture 13, page 9 CS677: Distributed OS Two-Phase Locking Two-phase locking.

Computer Science Lecture 13, page 10 CS677: Distributed OS Strict Two-Phase Locking Strict two-phase locking.

Computer Science Lecture 13, page 11 CS677: Distributed OS Timestamp-based Concurrency Control Each transaction Ti is given timestamp ts(Ti) If Ti wants to do an operation that conflicts with Tj –Abort Ti if ts(Ti) < ts(Tj) When a transaction aborts, it must restart with a new (larger) time stamp Two values for each data item x –Max-rts(x): max time stamp of a transaction that read x –Max-wts(x): max time stamp of a transaction that wrote x

Computer Science Lecture 13, page 12 CS677: Distributed OS Reads and Writes using Timestamps Read i (x) –If ts(T i ) < max-wts(x) then Abort T i –Else Perform R i (x) Max-rts(x) = max(max-rts(x), ts(T i )) Write i (x) –If ts(T i )<max-rts(x) or ts(T i )<max-wts(x) then Abort T i –Else Perform W i (x) Max-wts(x) = ts(T i )

Computer Science Lecture 13, page 13 CS677: Distributed OS Pessimistic Timestamp Ordering Concurrency control using timestamps.

Computer Science Lecture 13, page 14 CS677: Distributed OS Replication Data replication: common technique in distributed systems Reliability –If one replica is unavailable or crashes, use another –Protect against corrupted data Performance –Scale with size of the distributed system (replicated web servers) –Scale in geographically distributed systems (web proxies) Key issue: need to maintain consistency of replicated data –If one copy is modified, others become inconsistent

Computer Science Lecture 13, page 15 CS677: Distributed OS Object Replication Approach 1: application is responsible for replication –Application needs to handle consistency issues Approach 2: system (middleware) handles replication –Consistency issues are handled by the middleware –Simplifies application development but makes object-specific solutions harder

Computer Science Lecture 13, page 16 CS677: Distributed OS Replication and Scaling Replication and caching used for system scalability Multiple copies: –Improves performance by reducing access latency –But higher network overheads of maintaining consistency –Example: object is replicated N times Read frequency R, write frequency W If R<<W, high consistency overhead and wasted messages Consistency maintenance is itself an issue –What semantics to provide? –Tight consistency requires globally synchronized clocks! Solution: loosen consistency requirements –Variety of consistency semantics possible

Computer Science Lecture 13, page 17 CS677: Distributed OS Mid-term Exam Comments Closed book, closed notes, 90 min Lectures 1-13 included on the test –Focus on things taught in class (lectures, in-class discussions) –Start with lecture notes, read corresponding sections from text –Supplementary readings (key concepts) included on the test. Exam structure: few short answer questions, mix of subjective and “design” questions Good luck!