Software Transactional Memory and Conditional Critical Regions Word-Based Systems.

Slides:



Advertisements
Similar presentations
Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.
Advertisements

Maurice Herlihy (DEC), J. Eliot & B. Moss (UMass)
Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
CS 101 Introductory Programming - Lecture 7: Loops In C & Good Coding Practices Presenter: Ankur Chattopadhyay.
Concurrent programming for dummies (and smart people too) Tim Harris & Keir Fraser.
Code Generation and Optimization for Transactional Memory Construct in an Unmanaged Language Programming Systems Lab Microprocessor Technology Labs Intel.
Previously… Processes –Process States –Context Switching –Process Queues Threads –Thread Mappings Scheduling –FCFS –SJF –Priority scheduling –Round Robin.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Rich Transactions on Reasonable Hardware J. Eliot B. Moss Univ. of Massachusetts,
Toward High Performance Nonblocking Software Transactional Memory Virendra J. Marathe University of Rochester Mark Moir Sun Microsystems Labs.
Transactional Memory Overview Olatunji Ruwase Fall 2007 Oct
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
Parallelism and Concurrency Koen Lindström Claessen Chalmers University Gothenburg, Sweden Ulf Norell.
Transactional Memory Yujia Jin. Lock and Problems Lock is commonly used with shared data Priority Inversion –Lower priority process hold a lock needed.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
Exceptions and side-effects in atomic blocks Tim Harris.
Concurrent & Distributed Systems Lecture 10: Monitors What? –First of all, what NOT! The term ’monitor’ was used in the past for the mini operating system.
CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
6: Process Synchonization II 1 PROCESS SYNCHRONIZATION II THE BOUNDED BUFFER ( PRODUCER / CONSUMER ) PROBLEM: This is the same producer / consumer problem.
Chapter 11: Distributed Processing Variations of subprogram control
University of Pennsylvania 9/28/00CSE 3801 Concurrent Programming (Critical Regions, Monitors, and Threads) CSE 380 Lecture Note 6 Insup Lee.
Parallel Programming in Java with Shared Memory Directives.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
CS510 Concurrent Systems Introduction to Concurrency.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
Transactional Memory CDA6159. Outline Introduction Paper 1: Architectural Support for Lock-Free Data Structures (Maurice Herlihy, ISCA ‘93) Paper 2: Transactional.
Concurrency, Mutual Exclusion and Synchronization.
Software Transactional Memory Yoav Cohen Seminar in Distributed Computing Spring 2007 Yoav Cohen Seminar in Distributed Computing Spring 2007.
A Qualitative Survey of Modern Software Transactional Memory Systems Virendra J. Marathe Michael L. Scott.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
SXM: Software Transactional Memory in C# Maurice Herlihy.
Games Development 2 Concurrent Programming CO3301 Week 9.
CS 153: Concepts of Compiler Design October 5 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Optimistic Design 1. Guarded Methods Do something based on the fact that one or more objects have particular states  Make a set of purchases assuming.
Transactional Memory Lecturer: Danny Hendler. 2 2 From the New York Times…
Java Thread and Memory Model
The ATOMOS Transactional Programming Language Mehdi Amirijoo Linköpings universitet.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Optimistic Methods for Concurrency Control By: H.T. Kung and John Robinson Presented by: Frederick Ramirez.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
Java Producer-Consumer Monitor From: Concurrent Programming: The Java Programming Language By Steven J. Hartley Oxford University Press, 1998.
1 Synchronization via Transactions. 2 Concurrency Quiz If two threads execute this program concurrently, how many different final values of X are there?
Transactional Memory Student Presentation: Stuart Montgomery CS5204 – Operating Systems 1.
Synchronization CSCI 4900/6900. Transactions Protects data and allows processes to access and modify multiple data items as a single atomic transaction.
CS510 Concurrent Systems Jonathan Walpole. Introduction to Concurrency.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
R 1 Transactional abstractions: beyond atomic update Tim Harris r.

Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III
Maurice Herlihy and J. Eliot B. Moss,  ISCA '93
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
Transition to Code Upsorn Praphamontripong CS 1110
Chapter 5: Process Synchronization
Transactional Memory Coherence and Consistency
Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III
A Qualitative Survey of Modern Software Transactional Memory Systems
Part 1: Concepts and Hardware- Based Approaches
Critical section problem
Chapter 30 Condition Variables
Software Transactional Memory Should Not be Obstruction-Free
Chapter 6: Synchronization Tools
Exception Handling.
Presentation transcript:

Software Transactional Memory and Conditional Critical Regions Word-Based Systems

Introduction: Motivation Language Support for Lightweight Transactions (Harris & Fraser) Implement a declarative style of concurrency control where programmers indicate desired safety properties New syntax implements Hoare’s Conditional Critical Region Implemented using their STM CS 5204 – Fall, 2009

CCR – Conditional Critical Region CS 5204 – Fall, 2009 atomic (condition) { statements; } 1.Wait until Condition is satisfied 2.Execute statements atomically Means public int get() { atomic (items != 0) { items --; return buffer[items]; } PatternExample Use

CCR Implementation Built on top of Software Transactional Memory Uses all traditional STM commands and STMWait CS 5204 – Fall, 2009 boolean done = false; while (!done) { STMStart (); try { if (condition) { statements; done = STMCommit (); } else { STMWait(); } } catch (Throwable t) { done = STMCommit (); if (done) { throw t; }

Pairing Algorithm (Hash?) STM Heap Structure CS 5204 – Fall, Application Heap A1: 7 A2: 100 A3: 200 A4: 500 A5: Ownership Records.... Version 1

STM - Simple Transaction CS 5204 – Fall, 2009 boolean done = false; while (true) { STMStart(); readvalues; if(STMValidate()){ statements; done = STMCommit(); if(done) { break; }

Transaction Management STMStart() STMAbort() STMCommit() STMValidate() STMWait() CS 5204 – Fall, 2009

STM - Simple Transaction CS 5204 – Fall, Application Heap A1: 7 A2: 100 A3: 200 A4: 500 A5: Ownership Records.... Transaction Descriptor 1 Active A2: (100,7) -> (300,8) A1: (7,15) -> (7,15) Version 15 Version 7 Version x Version y Transaction Descriptor 1 Committed A2: 300 Version 8 1 1

STM Collisions - Abort CS 5204 – Fall, Application Heap A1: 7 A2: 100 A3: 200 A4: 500 A5: Ownership Records.... A2: (100,7) -> (300,8) A1: (7,15) -> (7,15) Version x Version y Transaction Descriptor 1 Active A2: (100, 7) -> (9,8) Transaction Descriptor 2 Active Committing A2’s Ownership Record is unavailable! Commit Fails - abort Transaction Descriptor 2 Aborted

STM Collisions - Sleep CS 5204 – Fall, 2009 boolean done = false; while (!done) { STMStart (); try { if (condition) { statements; done = STMCommit (); } else { STMWait(); } } catch (Throwable t) { done = STMCommit (); if (done) { throw t; } Abort and wait But when do I wake up? atomic (condition) { statements; }

STM Sleep CS 5204 – Fall, Application Heap A1: 7 A2: 100 A3: 200 A4: 500 A5: Ownership Records.... A2: (100,7) -> (300,8) A1: (7,15) -> (7,15) Version x Version y Transaction Descriptor 1 Active A1: (7,15) -> (7,15) Committing I failed my CCR condition, so I aborted and fell asleep Transaction Descriptor 2 Asleep Transaction Descriptor 1 Committed Wake-up

STM Stealing - Optimization CS 5204 – Fall, Application Heap A1: 7 A2: 100 A3: 200 A4: 500 A5: Ownership Records.... A2: (100,7) -> (300,8) A1: (7,15) -> (7,15) Version x Version y Transaction Descriptor 1 Committed A2: (300,8) -> (300,9) A3: (200, 8) -> (8,9) Transaction Descriptor 2 Active 2 1 1

STM – HTM Parallels: Data Copies CS 5204 – Fall, 2009 Old Data HTM: XCOMMIT STM: Xaction Descriptor Entry Old Data HTM: XCOMMIT STM: Xaction Descriptor Entry Original Memory New Data HTM: XABORT STM: Xaction Descriptor Entry New Data HTM: XABORT STM: Xaction Descriptor Entry Copy Commit

STM – HTM Parallels: 3 Tier Implementation CS 5204 – Fall, 2009 Transaction Runtime Snoopy CacheShared Memory Transaction Descriptors Ownership Records Application Heap HTM STM

Questions CS 5204 – Fall, 2009 ????????