Transactional Events Kevin Donnelly, Boston University

Slides:



Advertisements
Similar presentations
COMMUNICATING SEQUENTIAL PROCESSES C. A. R. Hoare The Queen’s University Belfast, North Ireland.
Advertisements

Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
Erlang concurrency. Where were we? Finished talking about sequential Erlang Left with two questions  retry – not an issue; I mis-read the statement in.
Verification of Hierarchical Cache Coherence Protocols for Future Processors Student: Xiaofang Chen Advisor: Ganesh Gopalakrishnan.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
USER LEVEL INTERPROCESS COMMUNICATION FOR SHARED MEMORY MULTIPROCESSORS Presented by Elakkiya Pandian CS 533 OPERATING SYSTEMS – SPRING 2011 Brian N. Bershad.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
1 Organization of Programming Languages-Cheng (Fall 2004) Concurrency u A PROCESS or THREAD:is a potentially-active execution context. Classic von Neumann.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Problem Solving Chapter 2. What is an algorithm? n A solution to a problem that is: –Precise –Effective –Terminating.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
Programming Paradigms for Concurrency Lecture 10 Part III – Message Passing Concurrency.
(Business) Process Centric Exchanges
Consensus and Its Impossibility in Asynchronous Systems.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
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.
Transactions and Concurrency Control Distribuerade Informationssystem, 1DT060, HT 2013 Adapted from, Copyright, Frederik Hermans.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
CORRECTNESS CRITERIA FOR CONCURRENCY & PARALLELISM 6/16/2010 Correctness Criteria for Parallelism & Concurrency 1.
Using a simple Rendez-Vous mechanism in Java
1 Combining Events and Threads for Scalable Network Services Peng Li and Steve Zdancewic University of Pennsylvania PLDI 2007, San Diego.
Storage Systems CSE 598d, Spring 2007 Rethink the Sync April 3, 2007 Mark Johnson.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
AtomCaml: First-class Atomicity via Rollback Michael F. Ringenburg and Dan Grossman University of Washington International Conference on Functional Programming.
ISA 95 Working Group (Business) Process Centric Exchanges Dennis Brandl A Modest Proposal July 22, 2015.
CIS NET Applications1 Chapter 7 – Asynchronous Calls.
CR 2025 – Component Synchronization Operations
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Last Class: Introduction
Transactions and Reliability
“Request /Reply Communication”
(Nested) Open Memory Transactions in Haskell
Outline Other synchronization primitives
Introduction to Triggers
Faster Data Structures in Transactional Memory using Three Paths
Other Important Synchronization Primitives
EEC 688/788 Secure and Dependable Computing
Two phase commit.
Challenges in Concurrent Computing
Persistency for Synchronization-Free Regions
CS603 Communication Mechanisms
Transactions Properties.
Alternating Bit Protocol
Changing thread semantics
Outline Announcements Fault Tolerance.
EEC 688/788 Secure and Dependable Computing
Iteration Implemented through loop constructs (e.g., in C++)
EEC 688/788 Secure and Dependable Computing
Background and Motivation
EEC 688/788 Secure and Dependable Computing
Distributed Shared Memory
Channels.
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Concurrency: Mutual Exclusion and Process Synchronization
VHDL Programming (08 Marks)
Presented by Neha Agrawal
EEC 688/788 Secure and Dependable Computing
A Refinement Calculus for Promela
Channels.
Computer Networking A Top-Down Approach Featuring the Internet
Channels.
EEC 688/788 Secure and Dependable Computing
Electrical and Computer Engineering
Understanding Real-World Concurrency Bugs in Go
Java Channel Access Client and Server Library - status
Concurrency in GO CS240 23/8/2017.
Module 10: Creating Transactional Business Processes
Transaction Communication
Presentation transcript:

Transactional Events Kevin Donnelly, Boston University Matthew Fluet, Cornell University (now TTI Chicago) ICFP’06

A New High-Level Abstraction Mechanism Transactional Events = First-class SynchronousMessage-Passing + Atomic Transactions Key Idea: Atomicity can enhance the expressive power of first-class synchronous message passing Transactional events enable elegant and simple solutions to interesting problems

What Transactional Events Can Do Transactional events allow for modular implementations where protocols are otherwise needed e.g. guarded synchronous receive Transactional events allow more powerful abstractions e.g. 3-way swap channels Transactional events allow easier reasoning about sequential composition under non-deterministic choice atomically { read x from c; if g x then return x else rollback }

Outline Comparison to transactional shared memory Features of Transactional Events synchronous message passing, synchronous choice and atomic sequencing guarded receive, 3-way swap Other Details handling exception, implementation, downsides

Atomicity and Isolation Shared memory transactions provide both atomicity and isolation atomicity: Transactions either complete and commit or rollback (intermediate states are not visible) isolation: Interleavings that are not serializable cause transaction failure (interleavings are not visible)

Transactional Event Monad Events are quiescent until triggered with `sync` data Evt a alwaysEvt :: a -> Evt a (return) thenEvt :: Evt a -> (a -> Evt b) -> Evt b (>>=) sync :: Evt a -> IO a

Synchronous Message Passing Messages are passed over channels Sender blocks for matching receiver data SChan a sendEvt :: SChan a -> a -> Evt () recvEvt :: SChan a -> Evt a

Synchronous Message-Passing Channels are created inside events Example newSChan :: Evt (SChan a) main = do c <- sync newSChan; forkIO (sync (recvEvt c)); sync (sendEvt c 0)

Atomicity Sequencing of events is atomic Example: disjunctive splitting thread1 = sync do { x <- recvEvt c1; sendEvt c2 x } thread2 = sync (sendEvt c1 0) thread3a = sync (recvEvt c1) thread3b = sync (recvEvt c2)

Non-deterministic choice Symmetric non-deterministic choice Example chooseEvt :: Evt a -> Evt a -> Evt a neverEvt :: Evt a recvEvt c `chooseEvt` do { sendEvt c 0; return 0 }

Communication Sequences and Non-deterministic Choice Without atomicity, need single-communication commit point c1; c2; …; ci; ci+1; …; cn With atomicity, chooseEvt does not commit to one branch unless the transaction commits pre-commit post-commit commit point do { _ <- recvEvt c; recvEvt c } `chooseEvt` do { sendEvt c 0; return 0 }

Guarded Receive grecvEvt :: (a -> Bool) -> SChan a -> Evt a grecvEvt g c = do x <- recvEvt c; if g x then return x else neverEvt

Triple Swap Channels type TriSChan a newTriSChan :: Evt (TriSChan a) swapEvt :: TriSchan a -> a -> Evt (a, a)

Triple Swap type TriSChan a = SChan (a, SChan (a, a)) swapEvt :: TriSChan a -> a -> (a, a) swapEvt ch x1 = client ` chooseEvt` leader where client = do { rCh <- newSChan; sendEvt ch (x1, rCh); recvEvt rCh } leader = do { (x2, rCh2) <- recvEvt ch; (x3, rCh3) <- recvEvt ch; sendEvt rCh2 (x3, x1); sendEvt rCh3 (x1, x2); alwaysEvt (x2, x3) } Not possible with first-class synchronous message-passing alone.

Other Details Exceptions reaching the top of a transaction cause rollback motivated by desire to preserve mutual-commitment properties Can encode both CML-like events and transactional shared memory Implementation as a library for GHC see paper for details Downsides Easy to get exponential behavior if you are not careful

Conclusion Atomicity can add power to first-class synchronous message-passing more flexible composition cooperation without protocols more powerful synchronization