Manchester University Transactions for Scala Daniel Goodman Euro TM Paris, May 2011.

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

An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
Pessimistic Software Lock-Elision Nir Shavit (Joint work with Yehuda Afek Alexander Matveev)
Error Management with Design Contracts Karlstad University Computer Science Error Management with Design Contracts Eivind J. Nordby, Martin Blom, Anna.
MotoHawk Training Model-Based Design of Embedded Systems.
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
SEERE Workshop, Neum Tempura Retargeting Damyan Mitev, Vladimir Valkanov Plovdiv University “Paisii Hilendarski”
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
Presented by: Ofer Kiselov & Omer Kiselov Supervised by: Dmitri Perelman Final Presentation.
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
Submitted by: Omer & Ofer Kiselov Supevised by: Dmitri Perelman Networked Software Systems Lab Department of Electrical Engineering, Technion.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Software Reuse Building software from reusable components Objectives
EPFL - March 7th, 2008 Interfacing Software Transactional Memory Simplicity vs. Flexibility Vincent Gramoli.
Prepared By E.Musa Alyaman1 Chapter 2 The Java Overview.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
KAUSHIK LAKSHMINARAYANAN MICHAEL ROZYCZKO VIVEK SESHADRI Transactional Memory: Hybrid Hardware/Software Approaches.
An Integrated Hardware-Software Approach to Transactional Memory Sean Lie Theory of Parallel Systems Monday December 8 th, 2003.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
The Center for Advanced Research In Software Engineering (ARISE) The University of Texas at Austin Reengineering of Large-Scale Polylingual Systems Mark.
Parallel Programming in Java with Shared Memory Directives.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
4.2.1 Programming Models Technology drivers – Node count, scale of parallelism within the node – Heterogeneity – Complex memory hierarchies – Failure rates.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Exception Handling in JAVA. Introduction Exception is an abnormal condition that arises when executing a program. In the languages that do not support.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Exception Handling Part 2: Creating and Throwing Exceptions CSIS 3701: Advanced Object Oriented Programming.
Code Complete Steve McConnell. 20. The Software-Quality Landscape.
Self-assembling Agent System Presentation 1 Donald Lee.
Exceptions cs1043. Program Exceptions When a program detects an error, what should it do? – Nothing, simply allow the program to fail. – Implement a course.
Transactional Lee’s Algorithm 1 A Study of a Transactional Routing Algorithm Ian Watson, Chris Kirkham & Mikel Lujan School of Computer Science University.
Cache Coherence Protocols 1 Cache Coherence Protocols in Shared Memory Multiprocessors Mehmet Şenvar.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
© Mohamed Nuzrath Java Programming :: Chapter 6 :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme coordinator IT Lecturer.
1 An Exception is… An unusual, often unpredictable event, detectable by software or hardware, that requires special processing An exception handler is.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Implementation Basics in C# code Minimal C++ code Application logic in Java code.
Cross Language Clone Analysis Team 2 February 3, 2011.
Design of A Custom Vector Operation API Exploiting SIMD Intrinsics within Java Presented by John-Marc Desmarais Authors: Jonathan Parri, John-Marc Desmarais,
SEERE Workshop, Ivanjica JTempura Vladimir Valkanov, Damyan Mitev Plovdiv University “Paisii Hilendarski”
Getting ready. Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Software, IEE Proceedings, Vol.152, Num.3, June 2005,Page(s): Prasanthi.S March, Java-based component framework for dynamic reconfiguration.
What Do Computers Do? A computer system is
16 Exception Handling.
Free Transactions with Rio Vista
Exceptions David Rabinowitz.
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Self Healing and Dynamic Construction Framework:
Part 2: Software-Based Approaches
Java Programming Language
Aritra Sengupta Man Cao Michael D. Bond and Milind Kulkarni
Martin Rinard Laboratory for Computer Science
Advanced Programming Fall 2017.
The PROCESS of Queries John Deardurff
Free Transactions with Rio Vista
Sampoorani, Sivakumar and Joshua
The PROCESS of Queries John Deardurff
Decomposing Hardware Lock Elision
WG4: Language Integration & Tools
Presentation transcript:

Manchester University Transactions for Scala Daniel Goodman Euro TM Paris, May 2011

Teraflux & Scala  Teraflux: Exploiting Data Parallelism for 1000 Core Processors Programming Models, Transactional Memory, Memory Models, Chip Design, Fault Tolerance,..... European Commission’s FP7 funded Using Scala as a basis for high productivity language  Scala Combination of Object Oriented and Functional Programming Models Compiles to JVM Byte-Code

Why MUTS Existing Scala STMs do not allow transactions to be added to code without restructuring the code. We want:  No difference between transaction syntax and other language constructs  No restrictions on transaction granularity  Works with legacy code  Maintainability

MUTS Syntax  atomic { body }  atomic { body } retry;  atomic { body } orElse { elseBody }  atomic(test) { body }  atomic(test) { body } retry;  atomic(test) { body } orElse { elseBody } Transaction that does not retry on failure Transaction that does retry on failure Transaction that runs alternative code on failure

Implementing MUTS 43 Possible locations within the compiler to add or augment passes to implement transactions  Two phases Modifications to the parser Java Agent to instrument the Byte-Code  Both of these work with well defined interfaces Scala JVM Byte-Code

Parser Modifications  Add new keywords  When an atomic section is detected: Add the control logic using existing tree constructs Encase the transactional code with an try/catch - Handle exceptions thrown by the body - Mark the code that is transactional - Allow transactions to abort Create a context to store the transaction meta-data Copy method variables so that active updates can be used on them by the body

Parser Modifications var committed$TM = false Var context$TM = null do{ context$TM = TM.beginTransaction() try { Body committed$TM = TM.commit(context$TM) } catch { case e:TransactionArea => () case e:TransactionException => context$TM.rollback() case e:Exception => { committed$TM = TM.commit(context$TM) if (committed$TM) throw e } } } while(!committed$TM) atomic { Body } retry;

Byte-Code Rewrite Modifying the Deuce Java Agent  Add Duplicate Methods  Detect atomic sections of methods Detect the location of the context Instrument field accesses Augment method calls Remove the marker exception

Byte-Code Rewrite h() f(Context c) g(int i, context c)g(int i) h(context c) f()

Byte-Code Rewrite var committed$TM = false Var context$TM = null do{ context$TM = TM.beginTransaction() try { Body committed$TM = TM.commit(context$TM) } catch { case e:TransactionArea => () case e:TransactionException => context$TM.rollback() case e:Exception => { committed$TM = TM.commit(context$TM) if (committed$TM) throw e } } while(!committed$TM)

Protecting Against Code Reordering try { System.out.println("This is the start of the test"); try{ foo(); } catch(IOException e) { System.out.println("IO exception"); } catch(NullPointerException e) { System.out.println("Null Pointer Exception"); } System.out.println("This is the end of the test"); } catch(Exception e) { System.out.println("The final Exception"); } Exception table: from to target type Class java/io/IOException Class java/lang/NullPointerException Class java/lang/Exception

Protecting Against Code Reordering try { System.out.println("This is the start of the test"); try{ foo(); } catch(IOException e) { System.out.println("IO exception"); } catch(NullPointerException e) { System.out.println("Null Pointer Exception"); } System.out.println("This is the end of the test"); } catch(Exception e) { System.out.println("The final Exception"); } Exception table: from to target type Class java/io/IOException Class java/lang/NullPointerException Class java/lang/Exception

Protecting Against Code Reordering try { System.out.println("This is the start of the test"); try{ foo(); } catch(IOException e) { System.out.println("IO exception"); } catch(NullPointerException e) { System.out.println("Null Pointer Exception"); } System.out.println("This is the end of the test"); } catch(Exception e) { System.out.println("The final Exception"); } Exception table: from to target type Class java/io/IOException Class java/lang/NullPointerException Class java/lang/Exception

What Have We Gained? User:  Native Constructs  No change of syntax  No restrictions on the granularity of transactions  No restrictions on the use of legacy code  Interoperable with Java Implementer:  Working against well defined interfaces  Native constructs with minimal changes to the compiler

Conclusions  MUTS is a much more intuitive and flexible STM for users  Interoperable with Java  Implemented with minimal changes to the parser, and no other changes to the compiler  Exception handler overcomes code reordering  This 2-phase approach can be applied to implementing other native constructs  Part of a suite of Scala STMs at Manchester Produced as part of the Teraflux Project

Other TM Research at Manchester  Applications: Transactional Parallel Routing Lee-TM (aka labyrinth in STAMP) [1][2]  TM Contention Managers [3]  Control of Optimistic Execution [4]  Scheduling of Transactions [5, 6]  Hardware TM [6, 7, 8]  Distributed TM [9, 10] Produced as part of the Teraflux Project

Selected References [1] Ian Watson, Chris Kirkham and Mikel Luján. A Study of a Transactional Parallel Routing Algorithm. PACT [2] Mohammad Ansari, Christos Kotselidis, Kim Jarvis, Mikel Luján, Chris Kirkham, and Ian Watson. Lee- TM: A Non-trivial Benchmark for Transactional Memory. ICA3PP [3] Mohammad Ansari, Christos Kotselidis, Mikel Luján, Chris Kirkham and Ian Watson. On the Performance of Contention Managers for Complex Transactional Memory Benchmarks. ISPDC [4] Mohammad Ansari, Mikel Luján, Christos Kotselidis, Kim Jarvis, Chris Kirkham and Ian Watson. Robust Adaptation to Available Parallelism in Transactional Memory Applications. In Transactions on High Performance and Embedded Architectures and Compilers, [5] Mohammad Ansari, Mikel Luján, Christos Kotselidis, Kim Jarvis, Chris Kirkham and Ian Watson. Transaction Reordering to Reduce Aborts in Software Transactional Memory. In Transactions on High Performance and Embedded Architectures and Compilers, [6] Mohammad Ansari, Behram Khan, Mikel Luján, Christos Kotselidis, Chris Kirkham and Ian Watson. Improving Performance by Reducing Aborts in Hardware Transactional Memory. In HIPEAC, [7] Behram Khan, Matthew Horsnell, Ian Rogers, Mikel Luján, Andrew Dinn, and Ian Watson. An Object- Aware Hardware Transactional Memory System. In HPCC, [8] Behram Khan, Matthew Horsnell, Mikel Luján, Andrew Dinn and Ian Watson. Exploiting object structure in hardware transactional memory. In EUROPAR, [9] Christos Kotselidis, Mohammad Ansari, Kim Jarvis, Mikel Luján, Chris Kirkham and Ian Watson. DiSTM: A Software Transactional Memory Framework for Clusters. In ICPP, 2008 [10] Christos Kotselidis, Mikel Luján, Mohammad Ansari, Konstantinos Malakasis, Behram Khan, Chris Kirkham and Ian Watson. Clustering JVMs with Software Transactional Memory Support. In IPDPS,