Changing thread semantics

Slides:



Advertisements
Similar presentations
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Advertisements

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
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.
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
Transaction Management Overview R & G Chapter 16 There are three side effects of acid. Enhanced long term memory, decreased short term memory, and I forget.
[ 1 ] Agenda Overview of transactional memory (now) Two talks on challenges of transactional memory Rebuttals/panel discussion.
Transaction Management and Concurrency Control
Transaction Management
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
1 Transaction Management Overview Chapter Transactions  A transaction is the DBMS’s abstract view of a user program: a sequence of reads and writes.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 18.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
Chapterb19 Transaction Management Transaction: An action, or series of actions, carried out by a single user or application program, which reads or updates.
Distributed Transactions
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Database Systems/COMP4910/Spring05/Melikyan1 Transaction Management Overview Unit 2 Chapter 16.
1 Transaction Management Overview Chapter Transactions  Concurrent execution of user programs is essential for good DBMS performance.  Because.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
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.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution Tom Bergan Owen Anderson, Joe Devietti, Luis Ceze, Dan Grossman To appear.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Transaction Management and Concurrent Control
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
4 November 2005 CS 838 Presentation 1 Nested Transactional Memory: Model and Preliminary Sketches J. Eliot B. Moss and Antony L. Hosking Presented by:
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Concurrent Revisions: A deterministic concurrency model. Daan Leijen & Sebastian Burckhardt Microsoft Research (OOPSLA 2010, ESOP 2011)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
Lecture 20: Consistency Models, TM
Part 2: Software-Based Approaches
Concurrency Control Techniques
Transaction Management and Concurrency Control
Why The Grass May Not Be Greener On The Other Side: A Comparison of Locking vs. Transactional Memory By McKenney, Michael, Triplett and Walpole.
Transaction Management Overview
Faster Data Structures in Transactional Memory using Three Paths
Transaction Management Transparencies
Transaction Management Overview
Transaction Management
Transaction Management Overview
Transaction Management Overview
Lecture 6: Transactions
Chapter 10 Transaction Management and Concurrency Control
Lecture 21: Transactional Memory
Lecture 22: Consistency Models, TM
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
Parallelism and Concurrency
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Transaction management
UNIVERSITAS GUNADARMA
Temple University – CIS Dept. CIS661 – Principles of Data Management
Transaction Management Overview
Lecture 21: Transactional Memory
Lecture: Consistency Models, TM
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
Lecture: Transactional Memory
Concurrency Unit 4.2 Dr Gordon Russell, Napier University
CSE 153 Design of Operating Systems Winter 2019
CSE 542: Operating Systems
CSE 542: Operating Systems
Transaction Management Overview
Transactions, Properties of Transactions
Presentation transcript:

Changing thread semantics Threads Redux Changing thread semantics Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Grace: Overview Goal Eliminate classes of concurrency errors For applications using fork-join parallelism Not appropriate for Reactive systems (servers) Systems with condition-based synchronization Approach Fully isolated threads (turning threads into processes) Leveraging virtual memory protections No need for locks (turn locks into no-ops) Sequential commit protocol Threads commit in program order Guarantees execution equivalent to serial execution Speculative thread execution Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Grace: Overview Features Overhead amortized over lifetime of thread Supports threads with irrevocable operations (e.g., I/O operations) Less memory overhead than comparable transactional memory techniques Concurrency error Cause Grace Prevention Deadlock Cyclic lock acquisition No locking Race condition Unguarded updates Updates committed deterministically Atomicity violation Interleaved updates Threads run atomically Order violation Threads scheduled in unexpected order Threads execute in program order Dennis Kafura – CS5204 – Operating Systems

Fork-Join Parallelism C B D E Serial elision used in Grace In Grace, fork-join parallelism is behaviorally equivalent to its sequential counterpart Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Thread Execution Each thread has private copies of changed pages (guarantees thread isolation) Page protection mechanisms used to detect reads/writes Access tracking and conflict detection at page granularity Page version numbers allow detection of conflicts In case of conflict, thread aborts/restarts Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Commit order Rules Parent waits for youngest (most recently created) child Child waits for youngest (most recently created) elder sibling, if it exists, or the parent’s youngest (most recently created) elder sibling Equivalent to post-order traversal of execution tree Guarantees equivalence to sequential execution Dennis Kafura – CS5204 – Operating Systems

Serial elision and commit order B D E A{ spawn B{ spawn C {…}; spawn D {…}; synch; //join for C and D } spawn E {…}; synch; //join for B and E Dennis Kafura – CS5204 – Operating Systems

Serial elision and commit order spawn E spawn D spawn C spawn B A A{ spawn B{ spawn C {…}; spawn D {…}; synch; } spawn E {…}; A waits for B E C D B E A C D postorder traveral elder younger Dennis Kafura – CS5204 – Operating Systems

Handling irrevocable I/O operations Each thread buffers I/O operations commits I/O operations with memory updates Thread attempting irrevocable I/O operation Waits for its immediate predecessor to commit Checks for consistency with committed state If consistent, perform irrevocable I/O operation Else, restart and perform irrevocable I/O operation as part of new execution Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Performance On 8 core system Minimal (1-16 lines) changes for Grace version Speedup for Grace comparable to pthreads but with guarantees of absence of concurrency errors Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Sammati Goals Eliminates deadlock in threaded codes Transparent to application (no code changes) Allows arbitrary use of locks for concurrency control Achieves composability of lock based codes Works for weakly typed languages (e.g., C/C++) Approach Containment Identify memory accesses associated with a lock Keep updates private while lock is held Make updates visible when lock is released Deadlock handling Automatic detection on lock acquisition Resolves deadlock by restarting one thread Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Sammati Key mechanisms Transparent mechanism for privatizing memory updates within a critical section Visibility rules that preserve lock semantics allow containment Deadlock detection and recovery Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Privatizing memory Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Visibility rules Locks not nested Begin privatizing changes to x when lock is acquired. x=y=0; acquire (L1); x++; release (L1); Allow changes to x to become (globally) visible when lock is released. Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Visibility rules Nested locks Cannot allow changes to x to become (globally) visible when L2 is released because of possible rollback to L1. x=y=0; acquire (L1); acquire(L2); x++; release(L2); acquire(L3); y++; release(L3); release (L1); Cannot allow changes to x or y to become (globally) visible when L3 is released because of possible rollback to L1. Rule: make changes visible when all locks released. Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Visibility rules Overlapping (unstructured) locks x=y=0; acquire (L1); x++; acquire(L2); y++; release(L1); release (L2); Cannot determine transparently with which lock(s) the data should be associated. Rule: make changes visible when all locks released. Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Deadlock detection A thread may only wait for (be blocked trying to acquire) one lock at a time Because thread state is privatized, deadlock can be resolved by rolling back and restarting one thread. L3 T2 T1 L4 L1 L2 T3 L5 Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Performance SPLASH benchmark Summati performance generally comparable to pthreads (one notable exception) Dennis Kafura – CS5204 – Operating Systems

Dennis Kafura – CS5204 – Operating Systems Performance Phoenix benchmark Summati performance generally comparable to pthreads Dennis Kafura – CS5204 – Operating Systems