What should we do with this freedom?

Similar documents
Concurrency Abstractions in C#

Concurrency Abstractions in C#

Concurrency Abstractions in C#

Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming

Deviations are things that modify a thread s normal flow of control. Unix has long had signals, and these must be dealt with in multithreaded

Annotation Hammer Venkat Subramaniam (Also published at

DS 2009: middleware. David Evans

CSE 451 Midterm 1. Name:

Grand Central Dispatch

Safety SPL/2010 SPL/20 1

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Multithreading and Interactive Programs

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Implementing Joins using Extensible Pattern Matching

The NoPlsql and Thick Database Paradigms

Remote Procedure Call

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Reminder from last time

RMI & RPC. CS 475, Spring 2019 Concurrent & Distributed Systems

Introduction to Semistructured Data and XML. Overview. How the Web is Today. Based on slides by Dan Suciu University of Washington

Web Services - Concepts, Architecture and Applications Part 3: Asynchronous middleware

STARCOUNTER. Technical Overview

Distributed Systems 8. Remote Procedure Calls

1.264 Lecture 16. Legacy Middleware

Linearizability of Persistent Memory Objects

Chapter 4 Defining Classes I

D Programming Language

CPS 310 midterm exam #1, 2/19/2016

Asynchronous and Synchronous Messaging with Web Services and XML Ronald Schmelzer Senior Analyst ZapThink, LLC

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

Design and Implementation of Modern Programming Languages (Seminar)

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Let s begin with the very beginning...

CS 2112 Lecture 20 Synchronization 5 April 2012 Lecturer: Andrew Myers

C# Asynchronous Programming Model

Distributed Middleware. Distributed Objects

Introduction to Semistructured Data and XML

CS A331 Programming Language Concepts

Programming Safe Agents in Blueprint. Alex Muscar University of Craiova

Week 6. Data structures

Rsyslog: going up from 40K messages per second to 250K. Rainer Gerhards

Globality Luca Cardelli Microsoft Research ETAPS 2001

Birth of Optimistic Methods. On Optimistic Methods for Concurrency Control. Basic performance arg

Multiprocessors 2007/2008

The Road to Object Orientation Operating Systems Object Planes. Object Planes. David Chisnall. March 25, 2010

Consistency: Relaxed. SWE 622, Spring 2017 Distributed Software Engineering

Cover Page. The handle holds various files of this Leiden University dissertation

Administrivia. Remote Procedure Calls. Reminder about last time. Building up to today

Java SE7 Fundamentals

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Today: Distributed Objects. Distributed Objects

The Myx Architectural Style

Lecture Concurrency versus parallelism Shared memory versus messages DSM. CMPSCI 377 Operating Systems Fall 2009

Using the SDACK Architecture to Build a Big Data Product. Yu-hsin Yeh (Evans Ye) Apache Big Data NA 2016 Vancouver

Architectural Styles. Software Architecture Lecture 5. Copyright Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved.

Java Threads and intrinsic locks

Database Management Systems. Chapter 1

Computation on Wide Area Networks

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

연세대학교전기전자공학과프로세서연구실박사과정김재억.

Implementing Architectures

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CMSC421: Principles of Operating Systems

Chapter 1: Distributed Information Systems

Real-Time and Concurrent Programming Lecture 4 (F4): Monitors: synchronized, wait and notify

Distributed Object-Based Systems The WWW Architecture Web Services Handout 11 Part(a) EECS 591 Farnam Jahanian University of Michigan.

CS18000: Programming I

Our topic. Concurrency Support. Why is this a problem? Why threads? Classic solution? Resulting architecture. Ken Birman

Introduction to Database Systems CSE 414

Operational Semantics. One-Slide Summary. Lecture Outline

Compositional C++ Page 1 of 17

Asynchronous OSGi: Promises for the masses. Tim Ward.

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Happy Birthday, Ajax4jsf! A Progress Report

Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS.

DISCUSSION 5min 2/24/2009. DTD to relational schema. Inlining. Basic inlining

C# 6.0 in a nutshell / Joseph Albahari & Ben Albahari. 6th ed. Beijin [etc.], cop Spis treści

CS 160: Interactive Programming

Summary Semaphores. Passing the Baton any await statement. Synchronisation code not linked to the data

Software Architecture

An update on XML types

It turns out that races can be eliminated without sacrificing much in terms of performance or expressive power.

DSD: A Schema Language for XML

CORBA in a Real-Time Game Environment

Architectural Styles I

Foundations of the C++ Concurrency Memory Model

Brief introduction of SocketPro continuous SQL-stream sending and processing system (Part 1: SQLite)

CmpSci 187: Programming with Data Structures Spring 2015

David DeFlyer Class notes CS162 January 26 th, 2009

Introduction. A Brief Description of Our Journey

Thirty one Problems in the Semantics of UML 1.3 Dynamics

Database Architectures

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Lecture 8: Threads. Lisa (Ling) Liu

Timo Latvala. January 28, 2004

Welcome to this IBM podcast, Realizing More. Value from Your IMS Compiler Upgrade. I'm Kimberly Gist

T Reactive Systems: Kripke Structures and Automata

Transcription:

Rotor (and the CLR), re-enable language experimentation. A pre-approved multi-language environment. With a flexible attitude towards further innovation. Open to the wider community. What should we do with this freedom? Add Generics/Polymorphism (Done!) Generic CLR/C#, Gyro Integrate Functional Languages (Done!) SML.NET, F#, ILX What else? 2003-04-23 2

!" ## We are in the middle of a transition in programming models (and possibly PLs) More radical than C to C++ (objects) or C++ to Java (strong typing). What s on the other side of the transition? Not clear, but lots of small and big steps are being taken into uncharted territory. We have a Cambrian explosion of programming models. Lots of badly misshaped things are going to evolve before architectures settle down. 2003-04-23 3

$% &' A new emphasis on computation on WANs Wide area data integration XML is net data. Need to integrate this new data into PLs. BIG DEBATE: hide, blend-in, or redesign? Wide area flow integration Impact Messages nor RPC, schedules not threads. Need to integrate these new flows into PLs. BIG DEBATE: hide, blend-in, or redesign? Not easy to fit this new stuff into existing PLs. Ideal for Rotor research 2003-04-23 4

()# PL data has traditionally been "triangular" (trees), while persistent data has traditionally been "square" (tables). This has caused huge integration problems. Now, BIG NEWS, persistent data is triangular too! (XML) New opportunity for PL integration. However, the type systems for PL data (based on tree matching) and XML (based on tree automata) are still deeply incompatible. Wouldn't it be nice to "program directly against the schemas" in a well-typed way? 2003-04-23 5

" )# Wouldn t it be nice to hide concurrency from programmers? SQL does it well. UI packages do it fine. RPC does it ok. But we are moving towards more asynchrony, I.e. towards more visible concurrency (BizTalks, etc.) You can hide all concurrency some of the time, and you can hide some concurrency all the time, but you can t hide all concurrency all the time. 2003-04-23 6

# It would be wrong to see these new net data and net flow features as "just" new Domain Specific Languages (DSLs). This are fundamental new concepts that may result in new kinds of "general purpose programming languages" for WANs. Analogy with past transitions: C++ was not just a DSL for objects, and Java was not just a DSL for type safety. We need more than just an XML DSL and a flow DSL. Keep an open mind: there may be great opportunities around the corner, either as evolutions of C#, or new languages. 2003-04-23 7

& Whether or not we merge new programming models into PLs, we need analysis tools for these new situations. Data: e.g.: data consistency checks. Flow: e.g.: behavioral type system. The new programming models are sophisticated (i.e. evil ), and require equally sophisticated (i.e. good ) analysis tools to protect developers. BIG Debate/Trade-off: Checked annotations, vs. inferred information. 2003-04-23 8

) Semistructured Data XDuce TQL Spatial Data Types <Unnamable> (Erik Meijer and Wolfram Shulte) Concurrent Flows BizTalk BPEL Polyphonic C# Sharpie <Unnamable> (Greg Meredith) 2003-04-23 9

New opportunities for Rotor research Both data and flow extensions are famously incompatible with standard languages: Schemas vs. (object) types impedence mismatch Concurrency vs. inheritance inheritance anomaly 2003-04-23 10

*)'+( (I.e.: XML after parsing) Paper Articles Paper Abiteboul, Buneman, Suciu: Data on the Web Author Title Year Author Author Title C A B 3 G D K A tree (or graph), unordered (or ordered). With labels on the edges. Invented for flexible data representation, for quasi-regular data like address books and bibliographies. Adopted by the DB community as a solution to the database merge problem: merging databases from uncoordinated (web) sources. Adopted by W3C as web data,, then by everybody else. 2003-04-23 11

),-( Not really arrays/lists: Many children with the same label, instead of indexed children. Mixture of repeated and non repeated labels under a node. Not really records: Many children with the same label. Missing/additional fields with no tagging information. Not really variants (tagged unions): Labeled but untagged unions. Unusual data. Yet, it aims to be the new universal standard for interoperability of programming languages, databases, e-commerce... 2003-04-23 12

!- ## New flexible types and schemas are required. Based on regular expressions over trees reviving techniques from tree-automata theory. New processing languages required. Xduce [Pierce, Hosoya], Cduce, our own Various web scripting abominations. New query languages required. Various approaches: From simple: Existence of paths through the tree. To fuzzy: Is a tree kind of similar to another one? To fancy: Is a tree produced by a tree grammar? To popular: SQL for trees/graphs, for some value of SQL. 2003-04-23 13

((. We want to talk about (specify/ query/ constrain/ type) the possible structure of data, for many possible reasons: Typing (and typechecking): for language and database use. Constraining (and checking): for policy or integrity use. Querying (and searching): for semistructured database use. Specifying (and verifying): for architecture or design documents. A description is a formal way of talking about the possible structure of data. We should go after a general framework: a very expressive language of descriptions. Special classes of descriptions can be used as types, schemas, constraints, queries, and specifications. 2003-04-23 14

Data Description Cambridge[ Eagle[ chair[0] ] chair[0] ] ] Cambridge[ Eagle[ chair[0] ] T ] T ] /.'%&.# data matches description In Cambridge there is (nothing but) a pub called the Eagle that contains (nothing but) two empty chairs. In Cambridge there is (at least) a pub called the Eagle that contains (at least) one empty chair. 2003-04-23 15

/.'0 With match variables : Who is really sitting at the Eagle? matches? Eagle[ chair[ 0 ] ] T ] Yes: = John[0] Yes: = Mary[0] With select-from from: from Eagle[...] match Eagle[chair chair[ 0 ] ] T] select person[] Single result: person[john John[0]] person[mary Mary[0]] 2003-04-23 16

We investigate 1 Powerful languages of data description, based on spatial logics. Akin to description logics of some time ago, but seen more as type systems. Special cases are regular expressions over trees (XML query, etc.) Lots of open problems in this area (typing and subtyping algorithms). 2003-04-23 17

*)'" Distribution => concurrency + latency => asynchrony => more concurrency Message-passing, event-based programming, dataflow models For programming languages, coordination (orchestration) languages & frameworks, workflow 2003-04-23 18

Why? ##..& Make invariants and intentions more apparent (part of the interface) Good software engineering Allows the compiler much more freedom to choose different implementations Also helps other tools 2003-04-23 19

Java-style monitors 2!%& OS shared memory primitives Clunky delegate-based asynchronous calling model Hard to understand, use and get right Different models at different scales Support for asynchrony all on the caller side little help building code to handle messages (must be thread-safe, reactive, and deadlock-free) 2003-04-23 20

&. An extension of the C# language with new concurrency constructs Based on the join calculus A foundational process calculus like the π-calculus but better suited to asynchronous, distributed systems It adapts remarkably well to classes and methods. A single model which works both for local concurrency (multiple threads on a single machine) distributed concurrency (asynchronous messaging over LAN or WAN) It is different But it s also simple if Mort can do any kind of concurrency, he can do this 2003-04-23 21

)' Objects have both synchronous and asynchronous methods. Values are passed by ordinary method calls: If the method is synchronous, the caller blocks until the method returns some result (as usual). If the method is async, the call completes at once and returns void. A class defines a collection of chords (synchronization patterns), which define what happens once a particular set of methods have been invoked. One method may appear in several chords. When pending method calls match a pattern, its body runs. If there is no match, the invocations are queued up. If there are several matches, an unspecified pattern is selected. If a pattern containing only async methods fires, the body runs in a new thread. 2003-04-23 22

$. class Buffer { String get() & async put(string s) { return s; } } 2003-04-23 23

$. class Buffer { String get() & async put(string s) { return s; } } An ordinary (synchronous) method with no arguments, returning a string 2003-04-23 24

$. class Buffer { String get() & async put(string s) { return s; } } An ordinary (synchronous) method with no arguments, returning a string An asynchronous method (hence returning no result), with a string argument 2003-04-23 25

$. class Buffer { String get() & async put(string s) { return s; } } An ordinary (synchronous) method with no arguments, returning a string An asynchronous method (hence returning no result), with a string argument Joined together in a chord 2003-04-23 26

$. class Buffer { String get() & async put(string s) { return s; } } Calls to put() return immediately (but are internally queued if there s no waiting get()). Calls to get() block until/unless there s a matching put() When there s a match the body runs, returning the argument of the put() to the caller of get(). Exactly which pairs of calls are matched up is unspecified. 2003-04-23 27

class Buffer { } $. String get() & async put(string s) { } return s; Does example this involve spawning any threads? No. Though the calls will usually come from different preexisting threads. So is it thread-safe? You don t seem to have locked anything Yes. The chord compiles into code which uses locks. (And that doesn t mean everything is synchronized on the object.) Which method gets the returned result? The synchronous one. And there can be at most one of those in a chord. 2003-04-23 28

3 using threads and mutexes in Modula 3 An introduction to programming with threads. Andrew D. Birrell, January 1989. 2003-04-23 29

3 4 public class ReaderWriter { public void Exclusive() & async Idle() {} public void ReleaseExclusive() { Idle(); } } public void Shared() & async Idle() { S(1); } public void Shared() & async S(int n) { S(n+1); } public void ReleaseShared() & async S(int n) { if (n == 1) Idle(); else S(n-1); } public ReaderWriter() { Idle(); } A single private message represents the state: none Idle() S(1) S(2) S(3) (exclusive) (available) (shared) A pretty transparent description of a simple state machine, as it should be. 2003-04-23 30

A clean, simple, new model for asynchronous concurrency in C# Declarative, local synchronization Model good for both local and distributed settings Efficiently compiled to queues and automata Easier to express and enforce concurrency invariants Compatible with existing constructs, though they constrain our design somewhat Minimalist design pieces to build whatever complex synchronization behaviours you need Solid foundations Works well in practice 2003-04-23 31

). Translate Polyphonic C# -> C# Built on Proebsting & Hanson s lcsc Introduce queues for pending calls (holding blocked threads for sync methods, arguments for asyncs) Generated code (using brief lock to protect queue state) looks for matches and then either Enqueues args (async no match) Enqueues thread and blocks (sync no match) Dequeues other args and continues (sync match) Wakes up blocked thread (async match with sync) Spawns new thread (async match all async) Efficient bitmasks to look for matches, no PulseAlls, 2003-04-23 32

New languages Language evolution is driven by elegance (mental efficiency). Language adoption is driven by need. We now badly need evolution in data handling and control flows. Lots of inelegant need-driven hacks. Some elegant designs here and there. Let s put them together! To C and beyond! 2003-04-23 33