Safe Reactive Programming: the FunLoft Proposal

Size: px
Start display at page:

Download "Safe Reactive Programming: the FunLoft Proposal"

Transcription

1 Safe Reactive Programming: the FunLoft Proposal Frédéric Boussinot MIMOSA Project, Inria Sophia-Antipolis (Joint work with Frédéric Dabrowski) With support from ALIDECS SYNCHRON

2 Introduction Why not a General Purpose Synchronous Language? Modularity: how to reuse code? Dynamicity: how to deal with non-static aspects? (ex: memory allocation) Asynchrony: how to deal with asynchronous aspects? (ex: blocking IOs) Safe programming? (ex: how to prove the termination of instants) Efficiency? (ex: how to benefit from multiprocessors) 2

3 Plan 1. Modularity & dynamicity: the causality issue 2. Mixing synchrony & asynchrony: the FairThreads model 3. Safe reactive programming: the FunLoft language 4. Efficiency: implementation on multicore architectures 5. Conclusion 3

4 Modularity (Compositionality) Question: how to define the specification associated with a given code, allowing this code to be used in various contexts? Problem with causality: specifications are over-complex Example: parallel combination of P and Q P = present s1 else emit s2 end, Q = present s2 then emit s1 end. P Q has no solution (causality error) (pause;p) Q is correct (constructive causality), but (pause;p) (pause;q) is not. (pause;pause;p) (pause;q) is correct, but... Information needed for putting P in parallel with Q without causality errors is as complex as the semantics (automaton) of P. No hope! The map is as large as the Empire... 4

5 Dynamicity Dynamic creation of new parallel components arise in many contexts: Interpretor: interpretation of a new entry Embedded system: new versions, adding of new functionalities Agent system: migrating agent reaching a new site Simulation: creation of new elements to simulate In all these contexts, it is difficultly acceptable that the creation of a new component could raise causality issues For both modularity and dynamicity concerns, causality issues are a major drawback 5

6 An Alternative to Causality Issues Delay to the next instant reaction to signal absence 1. present s then P else Q end: if s is present, P is immediately executed; if s is absent, Q is executed at the next instant. 2. If solutions with s present and s absent both exists, choose the one with absence. Example: in present s else emit s end, s is emitted at the next instant if it is absent Intuition: to be sure that a signal is absent you have to wait until the end of instant. Implementation: when waiting for s, execution suspends until s is emitted, or the instant terminates 6

7 Delayed Reaction to Absence Causality errors are ruled out Compositionality becomes achievable New parallel components can be added at run time SL, SugarCubes, ReactiveML, FairThreads,... are based on the delayed reaction to absence Limitations of expressivity: 1. No strong preemption (strong abort), only weak one 2. Values of signals not immediately available Pragmatics: not really severe restrictions... (anyway, to be compared to the introduction of pause statements to solve causality problems) Comparison with the standard approach (Esterel) still to be done for real-life programs 7

8 Plan 1. Modularity & dynamicity: the causality issue 2. Mixing synchrony & asynchrony: the FairThreads model 3. Safe reactive programming: the FunLoft language 4. Efficiency: implementation on multicore architectures 5. Conclusion 8

9 FairThreads Model of threads with shared memory Threads linked to a scheduler are run cooperatively and share the same instants. Synchronisation and communication through broadcast signals Several schedulers run asynchronously. Thread migration Unlinked threads run in a preemptive way 9

10 FairThreads - 2 GALS aspect of FairThreads: schedulers corresponds to locally synchronous areas; systems made of several schedulers are globally asynchronous Implementations: Java (restriction to a unique scheduler, 2002), Scheme (with specialised service threads, 2004), library of FairThreads in C (2005), LOFT (2006) Graphical simulations (cellular automata) 10

11 Many Problems Data-races (= interference = lack of atomicity, ex:!x+!x 2*!x) between linked and unlinked threads Data-races between threads linked to different schedulers Data-races between unlinked threads Non-cooperative thread linked to a scheduler (lack of reactivity) Uncontrolled creation of new threads Data with uncontrolled growing size (memory leaks) Buffering of communication between schedulers Actually, all are standard problems in concurrency and resource control! 11

12 Also Problems in Synchronous Languages These problems also exist for Synchronous Languages, at host language level module m : var x := Nil : list in loop x := f(x); pause end end end module Memory leaks: list f(list x) {return Cons(0,x);} Lack of reactivity: list f(list x) {return f(x);} Data-races in the context of GALS: list f(list x) {return Cons(global,Cons(global,x));} 12

13 Plan 1. Modularity & dynamicity: the causality issue 2. Mixing synchrony & asynchrony: the FairThreads model 3. Safe reactive programming: the FunLoft language 4. Efficiency: implementation on multicore architectures 5. Conclusion 13

14 FunLoft Inductive data types - First order functions Termination detection of recursively defined functions. Consequence: termination of instants ( reactivity ) Restriction on the flow of data carried by references and events (stratification) Consequence: bounded system size absence of memory leaks Separation of references (using a type and effect system): Schedulers own references shared by threads linked to them Threads own private references only accessible by them Consequence: atomicity of the cooperative model extended to unlinked threads and to multi-schedulers absence of data-races 14

15 FunLoft Basic Syntax p ::= x C(p,..., p) e ::= x C(e,..., e) match x with p > e... p > e f(e,..., e) let x = e in e ref e!e e:=e cooperate thread f(e,..., e) join e unlink e link s do e event generate e with e await e get all values e in e loop e while e do e Distinction function/module functions always terminate instantly; not mandatory for modules functions can be recursively defined, modules cannot Schedulers, functions, and modules defined at top-level only 15

16 Example of Code: Colliding Particles type particle_t = Particle of float ref * // x coord float ref * // y coord float ref * // x speed float ref * // y speed color_t // color Type of particles: Module defining the particle behaviour: let module particle_behavior (collide_event,color) = let s = new_particle (color) in begin thread bounce_behavior (s); thread collide_behavior (s,collide_event); thread draw_behavior (s); end Note: particle s is shared by the three threads 16

17 Collision Behaviour type a list = Nil_list Cons_list of a * a list let process_all_collisions (me,list) = match list with Nil_list -> () Cons_list (other,tail) -> begin collision (me,other); process_all_collisions (me,tail) end end let module collide_behavior (me,collide_event) = let r = ref Nil_list in loop begin generate collide_event with particle2coord (me); get_all_values collide_event in r; process_all_collisions (me,!r); inertia (me); end Function process all collisions proved to terminate. The loop in collide behavior proved to be not instantaneous 17

18 let module main () = let draw_event = event in let collide_event = event in begin end The Global System thread graphics (maxx,maxy,black); thread draw_processor (draw_event,size); repeat particle_number do thread particle_behavior (collide_event,draw_event,green); The program is ok: no possibility of data-races because shared particle data structures are only accessed by threads linked to the same scheduler 18

19 Static Analyses: Separation of the Memory Status public/private associated to references τ ref s : type of a public reference created in scheduler s τ ref : type of a private reference Memory separation property: A public reference created in the scheduler s can only be accessed by the threads linked to s A private reference can only be accessed by one unique thread Access effect = set of scheduler names Γ e:τ ref s,f Γ!e:τ,F {s} Γ e:τ ref,f Γ!e:τ,F 19

20 Checks: Separation of the Memory When linked to a scheduler, a thread should not access a public reference of an other scheduler 2. When unlinked a thread should not access a public reference Forbidden situations: Γ e:f F {s} Γ link s do e: Γ e: Γ unlink e: 20

21 Separation of the Memory - 3 One must also prevent a thread to access a private reference of another thread Check 3: parameters of a new thread should not be private f:τ ()/F Γ e i :τ i,f i τ i =τ i ref α i α i Γ thread f(e): F i Forbidden: private reference pointed to by a public reference 21

22 Separation of the Memory - 4 Check 4: a reference and its initializing value should have same status Γ e:τ,f τ=τ ref α α Γ ref s e:τ ref s,f Γ e:τ,f τ=τ ref α α= Γ ref e:τ ref,f Proof: Memory separation is preserved by rewriting in the formal operational semantics (extended with explicit ownership of private references) 22

23 Static Analyses: Memory Leaks References should not be used as accumulators let r = ref Nil_list let f () =!r let module m () = loop begin r := Cons_list (0,f()); cooperate end Stratification of references : region associated to each reference creation r : a list ref k Types with read/write effect: f : unit a list [read : k, write :] e 1 := e 2 adds the arrow k 1 k 2 in the information flow graph, for all k 1 written by e 1 and all k 2 read by e 2. Absence of cycles in the graph is checked; in m, k k 23

24 let f (r1,r2) = r1:=!r2 Inference with Constraints Types with effects and constraints f : a ref k b ref l unit [read : b ref l, write : a ref k ] ( a ref k b ref l ) let nok () = let r = ref N il list in f (r,r) a list ref k a list ref k k k error let ok () = let r = ref 0 in f (r,r) int ref k int ref k ok Constraints are collected during the construction of the most general unifier, and checked when complete 24

25 Termination of Recursive Functions type a list = Nil list Cons list of a a list Strict sub-term order: Cons list (head, tail) tail Lexicographic extension: f (a, Cons list (h, tail), t) f (a, tail, Cons list (h, t)) Analyses of chains of calls for arguments of inductive types let process all collisions (me, list) = match list with Nil list > () Cons list (other, tail) > begin collision (me, other); process all collisions (me, tail) end end list = Cons list(other, tail) list tail (me, list) (me, tail) 25

26 Several other Static Analyses No instantaneous loops No uncontrolled thread creation in loops loop begin thread m (); cooperate end No thread creation while unlinked (unlink thread m ()) Events used in correct context Generated values should also be stratified No reference embedded in generated value No event shared by distinct schedulers No use of events while unlinked Result: a well-typed program runs in bounded memory, without data-races, and instants always terminate 26

27 References Basic reactive model: A Synchronous pi-calculus, R. Amadio, Journal of Information and Computation 205, 9 (2007) Memory separation only, 1 scheduler, no events: Cooperative Threads and Preemptive Computations, Dabrowski, F. and Boussinot, F., Proceedings of TV 06, Seattle, Model without distinction module/function nor join (memory separation proved) + polynomial resource control: Programmation Réactive Synchrone, Langage et Contrôle des Ressources, F. Dabrowski s Thesis, Paris 7, june Ongoing work: Formalisation of FunLoft, F. Boussinot, F. Dabrowski. 27

28 Plan 1. Modularity & dynamicity: the causality issue 2. Mixing synchrony & asynchrony: the FairThreads model 3. Safe reactive programming: the FunLoft language 4. Efficiency: implementation on multicore architectures 5. Conclusion 28

29 Multicore Programming How can a single application benefit from a multicore architecture? Answer: multithreading! General problem: how to get maximum of concurrency + absence of data-races + maximum of parallelism Specific problem: How to adapt the colliding particles simulation to multicore machines? Idea: 2 schedulers, each one simulating half of the particles. Problem 1: strong synchronisation between schedulers needed (to animate particles uniformly). Problem 2: collide event shared between the 2 schedulers (forbidden as the schedulers are asynchronous). 29

30 Proposal: Synchronised Schedulers Strong synchronisation between schedulers (common ends of instants), but parallelism during instants No sharing of memory (to avoid data races) Events shared among synchronised schedulers 30

31 Multithreaded Colliding Particles let s1 = scheduler and s2 = scheduler let module main () = let draw_event = event in let collide_event = event in begin link s1 do begin thread graphics (maxx,maxy,black); thread draw_processor (draw_event,size); repeat particle_number / 2 do thread particle_behavior (collide_event,draw_event,green); end; link s2 do repeat particle_number / 2 do thread particle_behavior (collide_event,draw_event,red); end 31

32 Demo CPU usage (left: 1 scheduler, right: 2 schedulers) 100% CPU 150% CPU Time to simulate 500 particles during 100 instants 1 sched 2 scheds real 0m21.832s 0m14.189s user 0m21.102s 0m21.369s sys 0m0.220s 0m0.379s Gain: 21/14 = 1.5 Gain (1000 instants) particles gain

33 Conclusion FunLoft is experimental and far from being a GPSL! Lack of realistic bounds (polynomial?) Over-restricted detection of termination of functions No distribution, no objects, etc... FunLoft provides: Concurrent programming with clear semantics Static analyses to prevent data-races and memory leaks, and to ensure reactivity Efficient implementation: large number of components Syntax for multithreaded applications on multicore architectures Compiler available at 33

The Esterel language

The Esterel language Pascal Raymond, Verimag-CNRS Introduction 2 The first synchronous language (early 80 s) Gérard Berry and his team (École des Mines de Paris / INRIA Sophia-Antipolis) Imperative, sequential style (i.e.

More information

Introduction 2 The first synchronous language (early 80 s) Gérard Berry and his team (École des Mines de Paris / INRIA Sophia-Antipolis) Imperative, s

Introduction 2 The first synchronous language (early 80 s) Gérard Berry and his team (École des Mines de Paris / INRIA Sophia-Antipolis) Imperative, s Pascal Raymond, Verimag-CNRS Introduction 2 The first synchronous language (early 80 s) Gérard Berry and his team (École des Mines de Paris / INRIA Sophia-Antipolis) Imperative, sequential style (i.e.

More information

Programming Safe Agents in Blueprint. Alex Muscar University of Craiova

Programming Safe Agents in Blueprint. Alex Muscar University of Craiova Programming Safe Agents in Blueprint Alex Muscar University of Craiova Programmers are craftsmen, and, as such, they are only as productive as theirs tools allow them to be Introduction Agent Oriented

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems SHIM:A A Deterministic Concurrent Language for Embedded Systems p. 1/28 A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A

More information

Clock-directed Modular Code-generation for Synchronous Data-flow Languages

Clock-directed Modular Code-generation for Synchronous Data-flow Languages 1 Clock-directed Modular Code-generation for Synchronous Data-flow Languages Dariusz Biernacki Univ. of Worclaw (Poland) Jean-Louis Colaço Prover Technologies (France) Grégoire Hamon The MathWorks (USA)

More information

SugarCubes Implementation of Causality

SugarCubes Implementation of Causality INSTITUT NATIONAL DE RECHERCHE EN INFORMATIQUE ET EN AUTOMATIQUE SugarCubes Implementation of Causality Frédéric Boussinot N 3487 Septembre 1998 THÈME 1 apport de recherche ISSN 0249-6399 "!#$#%& ' (!)+*,.-0/213/4-6587:9=3?0?658@3;+A

More information

Weak Memory Models: an Operational Theory

Weak Memory Models: an Operational Theory Opening Weak Memory Models: an Operational Theory INRIA Sophia Antipolis 9th June 2008 Background on weak memory models Memory models, what are they good for? Hardware optimizations Contract between hardware

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/30 Definition

More information

A Simple Example. The Synchronous Language Esterel. A First Try: An FSM. The Esterel Version. The Esterel Version. The Esterel Version

A Simple Example. The Synchronous Language Esterel. A First Try: An FSM. The Esterel Version. The Esterel Version. The Esterel Version The Synchronous Language Prof. Stephen. Edwards Simple Example The specification: The output O should occur when inputs and have both arrived. The R input should restart this behavior. First Try: n FSM

More information

Synchronous Statecharts. Christian Motika

Synchronous Statecharts. Christian Motika Execution (KlePto) Esterel to transformation (KIES) Synchronous Statecharts for executing Esterel with Ptolemy Christian Motika Real-Time Systems and Embedded Systems Group Department of Computer Science

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/38 Definition

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

Concurrent Objects and Linearizability

Concurrent Objects and Linearizability Chapter 3 Concurrent Objects and Linearizability 3.1 Specifying Objects An object in languages such as Java and C++ is a container for data. Each object provides a set of methods that are the only way

More information

Synchronous Kahn Networks (ten years later)

Synchronous Kahn Networks (ten years later) Synchronous Kahn Networks (ten years later) Marc Pouzet LRI Marc.Pouzet@lri.fr Workshop SYNCHRON, 27/11/06 Overview The origins From Lustre to Lucid Synchrone Developping a Language Conclusion The origins

More information

Types for References, Exceptions and Continuations. Review of Subtyping. Γ e:τ τ <:σ Γ e:σ. Annoucements. How s the midterm going?

Types for References, Exceptions and Continuations. Review of Subtyping. Γ e:τ τ <:σ Γ e:σ. Annoucements. How s the midterm going? Types for References, Exceptions and Continuations Annoucements How s the midterm going? Meeting 21, CSCI 5535, Spring 2009 2 One-Slide Summary Review of Subtyping If τ is a subtype of σ then any expression

More information

Predictable Execution with IEC 61499

Predictable Execution with IEC 61499 Predictable Execution with IEC 61499 Li Hsien Yoong The University of Auckland Sequence of presentation What has been achieved: Deterministic behaviour of centralized IEC 61499 systems Current goal: Deterministic

More information

Verifying Concurrent ML programs

Verifying Concurrent ML programs Verifying Concurrent ML programs a research proposal Gergely Buday Eszterházy Károly University Gyöngyös, Hungary Synchron 2016 Bamberg December 2016 Concurrent ML is a synchronous language a CML program

More information

Using and Compiling Esterel

Using and Compiling Esterel Using and Compiling Esterel Stephen A. Edwards Columbia University Department of Computer Science sedwards@cs.columbia.edu http://www.cs.columbia.edu/ sedwards/ Memocode Tutorial, July 11, 2005 The Esterel

More information

Programming Languages Lecture 15: Recursive Types & Subtyping

Programming Languages Lecture 15: Recursive Types & Subtyping CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)

More information

The SugarCubes Tool Box

The SugarCubes Tool Box The SugarCubes Tool Box Frédéric BOUSSINOT, Jean-Ferdy SUSINI INRIA EMP-CMA/Meije 2004 route des lucioles F-06902 Sophia-Antipolis fb@sophia.inria.fr, jfsusini@sophia.inria.fr Abstract The SugarCubes are

More information

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu, Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety

More information

Language Extensions. present [C and not pre(a or B or C)] then p else q end

Language Extensions. present [C and not pre(a or B or C)] then p else q end A Language Extensions The full Esterel V5 language includes the Kernel Esterel primitives and derived statements whose semantics are given by structural expansion into the primitives. The full language

More information

Theoretical Corner: The Non-Interference Property

Theoretical Corner: The Non-Interference Property Theoretical Corner: The Non-Interference Property Marwan Burelle marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 Introduction 2 Theory And Security Models And Policies Non-Interference

More information

EE382N.23: Embedded System Design and Modeling

EE382N.23: Embedded System Design and Modeling EE382N.23: Embedded System Design and Modeling Lecture 3 Language Semantics Andreas Gerstlauer Electrical and Computer Engineering University of Texas at Austin gerstl@ece.utexas.edu Lecture 3: Outline

More information

Petri Nets ee249 Fall 2000

Petri Nets ee249 Fall 2000 Petri Nets ee249 Fall 2000 Marco Sgroi Most slides borrowed from Luciano Lavagno s lecture ee249 (1998) 1 Models Of Computation for reactive systems Main MOCs: Communicating Finite State Machines Dataflow

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development

More information

Synchronous Specification

Synchronous Specification Translation Validation for Synchronous Specification in the Signal Compiler Van-Chan Ngo Jean-Pierre Talpin Thierry Gautier INRIA Rennes, France FORTE 2015 Construct a modular translation validationbased

More information

ECE519 Advanced Operating Systems

ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (4 th Week) (Advanced) Operating Systems 4. Threads Processes and Threads Types of Threads Multicore and Multithreading

More information

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler.

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler. Goal Understand what this interface means and why it matters: CS152: Programming Languages Lecture 15 Parametric Polymorphism Dan Grossman Spring 2011 type a mylist; val mt_list : a mylist val cons : a

More information

Programming Languages for Real-Time Systems. LS 12, TU Dortmund

Programming Languages for Real-Time Systems. LS 12, TU Dortmund Programming Languages for Real-Time Systems Prof. Dr. Jian-Jia Chen LS 12, TU Dortmund 20 June 2016 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 1 / 41 References Slides are based on Prof. Wang Yi, Prof.

More information

Pierce Ch. 3, 8, 11, 15. Type Systems

Pierce Ch. 3, 8, 11, 15. Type Systems Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using

More information

Static Analysis by A. I. of Embedded Critical Software

Static Analysis by A. I. of Embedded Critical Software Static Analysis by Abstract Interpretation of Embedded Critical Software Julien Bertrane ENS, Julien.bertrane@ens.fr Patrick Cousot ENS & CIMS, Patrick.Cousot@ens.fr Radhia Cousot CNRS & ENS, Radhia.Cousot@ens.fr

More information

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

Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming Nicolas Bettenburg 1 Universitaet des Saarlandes, D-66041 Saarbruecken, nicbet@studcs.uni-sb.de Abstract. As traditional

More information

Course on Probabilistic Methods in Concurrency. (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1

Course on Probabilistic Methods in Concurrency. (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1 Course on Probabilistic Methods in Concurrency (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1 The pi-calculus and the asynchronous pi-calculus. Catuscia Palamidessi INRIA

More information

Part VI. Imperative Functional Programming

Part VI. Imperative Functional Programming Part VI Imperative Functional Programming Chapter 14 Mutable Storage MinML is said to be a pure language because the execution model consists entirely of evaluating an expression for its value. ML is

More information

A step towards reconciling GALS industrial design with formal verification

A step towards reconciling GALS industrial design with formal verification A step towards reconciling GALS industrial design with formal verification Fatma Jebali Join work with Frédéric Lang & Radu Mateescu Inria Grenoble France LASER Summer School September 13 th, 2014 GALS:

More information

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Hoare logic. A proof system for separation logic. Introduction. Separation logic Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

Cyber Physical System Verification with SAL

Cyber Physical System Verification with SAL Cyber Physical System Verification with July 22, 2013 Cyber Physical System Verification with Outline 1 2 3 4 5 Cyber Physical System Verification with Table of Contents 1 2 3 4 5 Cyber Physical System

More information

Programming Languages Lecture 14: Sum, Product, Recursive Types

Programming Languages Lecture 14: Sum, Product, Recursive Types CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate

More information

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

Cover Page. The handle   holds various files of this Leiden University dissertation Cover Page The handle http://hdl.handle.net/1887/22891 holds various files of this Leiden University dissertation Author: Gouw, Stijn de Title: Combining monitoring with run-time assertion checking Issue

More information

Compiling Esterel. Dumitru Potop-Butucaru. Stephen A. Edwards Gérard Berry

Compiling Esterel. Dumitru Potop-Butucaru. Stephen A. Edwards Gérard Berry Compiling Esterel Compiling Esterel Dumitru Potop-Butucaru Stephen A. Edwards Gérard Berry A C.I.P. Catalogue record for this book is available from the Library of Congress. ISBN 978-0-387-70626-9 (HB)

More information

Lock-sensitive Interference Analysis for Java: Combining Program Dependence Graphs with Dynamic Pushdown Networks

Lock-sensitive Interference Analysis for Java: Combining Program Dependence Graphs with Dynamic Pushdown Networks Lock-sensitive Interference Analysis for Java: Combining Program Dependence Graphs with Dynamic Pushdown Networks Jürgen Graf 1, Martin Hecker 1, Martin Mohr 1, and Benedikt Nordhoff 2 1 Karlsruhe Institute

More information

Hiding local state in direct style: a higher-order anti-frame rule

Hiding local state in direct style: a higher-order anti-frame rule 1 / 65 Hiding local state in direct style: a higher-order anti-frame rule François Pottier January 28th, 2008 2 / 65 Contents Introduction Basics of the type system A higher-order anti-frame rule Applications

More information

A Transactional Model and Platform for Designing and Implementing Reactive Systems

A Transactional Model and Platform for Designing and Implementing Reactive Systems A Transactional Model and Platform for Designing and Implementing Reactive Systems Justin R. Wilson A dissertation presented to the Graduate School of Arts and Sciences of Washington University in partial

More information

We defined congruence rules that determine the order of evaluation, using the following evaluation

We defined congruence rules that determine the order of evaluation, using the following evaluation CS 4110 Programming Languages and Logics Lectures #21: Advanced Types 1 Overview In this lecture we will extend the simply-typed λ-calculus with several features we saw earlier in the course, including

More information

Simply-Typed Lambda Calculus

Simply-Typed Lambda Calculus #1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What

More information

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012 CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our

More information

Quis Custodiet Ipsos Custodes The Java memory model

Quis Custodiet Ipsos Custodes The Java memory model Quis Custodiet Ipsos Custodes The Java memory model Andreas Lochbihler funded by DFG Ni491/11, Sn11/10 PROGRAMMING PARADIGMS GROUP = Isabelle λ β HOL α 1 KIT 9University Oct 2012 of the Andreas State of

More information

CS 4110 Programming Languages & Logics. Lecture 35 Typed Assembly Language

CS 4110 Programming Languages & Logics. Lecture 35 Typed Assembly Language CS 4110 Programming Languages & Logics Lecture 35 Typed Assembly Language 1 December 2014 Announcements 2 Foster Office Hours today 4-5pm Optional Homework 10 out Final practice problems out this week

More information

λ calculus is inconsistent

λ calculus is inconsistent Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles

More information

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich From IMP to Java Andreas Lochbihler ETH Zurich parts based on work by Gerwin Klein and Tobias Nipkow 2015-07-14 1 Subtyping 2 Objects and Inheritance 3 Multithreading 1 Subtyping 2 Objects and Inheritance

More information

The Abstract Behavioral Specification Language

The Abstract Behavioral Specification Language The Abstract Behavioral Specification Language Frank S. de Boer CWI frb@cwi.nl Scientific Meeting CWI, November 29, 2013 How It All Started? Simula (Ole Johan Dahl, Turing award 2001) Credo FP6 project

More information

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas Parallel Computer Architecture Spring 2018 Memory Consistency Nikos Bellas Computer and Communications Engineering Department University of Thessaly Parallel Computer Architecture 1 Coherence vs Consistency

More information

Curing Schizophrenia by Program Rewriting in Esterel

Curing Schizophrenia by Program Rewriting in Esterel Curing Schizophrenia by Program Rewriting in sterel Olivier Tardieu INRIA Sophia Antipolis, France olivier.tardieu@sophia.inria.fr Robert de Simone INRIA Sophia Antipolis, France robert.de simone@sophia.inria.fr

More information

Reactive Web Programming

Reactive Web Programming Reactive Web Programming Colin Vidal colin.vidal@inria.fr INRIA Sophia Antipolis Supervisors : Manuel Serrano Gérard Berry December 2, 2015 1 / 14 JavaScript language A mainstream language to write web

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Models of concurrency & synchronization algorithms

Models of concurrency & synchronization algorithms Models of concurrency & synchronization algorithms Lecture 3 of TDA383/DIT390 (Concurrent Programming) Carlo A. Furia Chalmers University of Technology University of Gothenburg SP3 2016/2017 Today s menu

More information

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC. hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Java features. Java and its associated components. Features of a Java application and applet. Java data types. Java

More information

The Esterel Language. The Esterel Version. Basic Ideas of Esterel

The Esterel Language. The Esterel Version. Basic Ideas of Esterel The Synchronous Language Esterel OMS W4995-02 Prof. Stephen. Edwards Fall 2002 olumbia University epartment of omputer Science The Esterel Language eveloped by Gérard erry starting 1983 Originally for

More information

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions CMSC 330: Organization of Programming Languages Multithreaded Programming Patterns in Java CMSC 330 2 Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to

More information

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m. CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

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

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Sémantique des Langages de Programmation (SemLP) DM : Region Types

Sémantique des Langages de Programmation (SemLP) DM : Region Types Sémantique des Langages de Programmation (SemLP) DM : Region Types I) Submission Submission Date : 21/05/2017 Submission Format : Submit a virtual machine (.ova) 1 with 1. an executable of the interpreter,

More information

MPRI course 2-4 Functional programming languages Exercises

MPRI course 2-4 Functional programming languages Exercises MPRI course 2-4 Functional programming languages Exercises Xavier Leroy October 13, 2016 Part I: Interpreters and operational semantics Exercise I.1 (**) Prove theorem 2 (the unique decomposition theorem).

More information

CSCE 313: Intro to Computer Systems

CSCE 313: Intro to Computer Systems CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313/ Programs, Processes, and Threads Programs and Processes Threads 1 Programs, Processes, and

More information

The learning objectives of this chapter are the followings. At the end of this chapter, you shall

The learning objectives of this chapter are the followings. At the end of this chapter, you shall Chapter 5 Sequence diagrams In the previous chapters, we have seen different diagrams. Use case diagrams describe tasks that a system is supposed to perform. It gives high-level information about how a

More information

Hierarchical Pointer Analysis for Distributed Programs

Hierarchical Pointer Analysis for Distributed Programs Hierarchical Pointer Analysis for Distributed Programs Amir Kamil Computer Science Division, University of California, Berkeley kamil@cs.berkeley.edu April 14, 2006 1 Introduction Many distributed, parallel

More information

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song Programs, Processes, and Threads Programs and Processes Threads Programs, Processes, and Threads Programs and Processes Threads Processes

More information

Tutorial and Reference Manual

Tutorial and Reference Manual Zélus: a Synchronous Language with ODEs Release, version 1.2 Tutorial and Reference Manual http://zelus.di.ens.fr Marc Pouzet Albert Benveniste, Timothy Bourke and Benoit Caillaud Inria Project Team PARKAS,

More information

Multithreading and Interactive Programs

Multithreading and Interactive Programs Multithreading and Interactive Programs CS160: User Interfaces John Canny. Last time Model-View-Controller Break up a component into Model of the data supporting the App View determining the look of the

More information

Type Inference Systems. Type Judgments. Deriving a Type Judgment. Deriving a Judgment. Hypothetical Type Judgments CS412/CS413

Type Inference Systems. Type Judgments. Deriving a Type Judgment. Deriving a Judgment. Hypothetical Type Judgments CS412/CS413 Type Inference Systems CS412/CS413 Introduction to Compilers Tim Teitelbaum Type inference systems define types for all legal programs in a language Type inference systems are to type-checking: As regular

More information

States Transitions Connectors Esterel Studio

States Transitions Connectors Esterel Studio Time in Differences SyncCharts differ from other implementations of : Synchronous framework Determinism Compilation into backend language Esterel No interpretation for simulations No hidden behaviour Multiple

More information

Processes and Threads

Processes and Threads TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Processes and Threads [SGG7] Chapters 3 and 4 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin

More information

Threading and Synchronization. Fahd Albinali

Threading and Synchronization. Fahd Albinali Threading and Synchronization Fahd Albinali Parallelism Parallelism and Pseudoparallelism Why parallelize? Finding parallelism Advantages: better load balancing, better scalability Disadvantages: process/thread

More information

Jonathan Protzenko (INRIA)

Jonathan Protzenko (INRIA) Mezzo a typed language for safe and effectful concurrent programs Jonathan Protzenko (INRIA) jonathan.protzenko@inria.fr Jonathan Protzenko INRIA Mezzo: the defense Sept. 29th, 2014 1 / 59 This defense:

More information

Nominal games: a semantics paradigm for effectful languages

Nominal games: a semantics paradigm for effectful languages Nominal games: a semantics paradigm for effectful languages Nikos Tzevelekos, QMUL jointly with: Andrzej Murawski, Warwick Steven Ramsay, Oxford Dan Ghica, Birmingham Guilhem Jaber, Paris Diderot Thomas

More information

Foundations. Yu Zhang. Acknowledgement: modified from Stanford CS242

Foundations. Yu Zhang. Acknowledgement: modified from Stanford CS242 Spring 2013 Foundations Yu Zhang Acknowledgement: modified from Stanford CS242 https://courseware.stanford.edu/pg/courses/317431/ Course web site: http://staff.ustc.edu.cn/~yuzhang/fpl Reading Concepts

More information

Reinhard v. Hanxleden 1, Michael Mendler 2, J. Aguado 2, Björn Duderstadt 1, Insa Fuhrmann 1, Christian Motika 1, Stephen Mercer 3 and Owen Brian 3

Reinhard v. Hanxleden 1, Michael Mendler 2, J. Aguado 2, Björn Duderstadt 1, Insa Fuhrmann 1, Christian Motika 1, Stephen Mercer 3 and Owen Brian 3 Sequentially Constructive Concurrency * A conservative extension of the Synchronous Model of Computation Reinhard v. Hanxleden, Michael Mendler 2, J. Aguado 2, Björn Duderstadt, Insa Fuhrmann, Christian

More information

Concurrent & Distributed Systems Supervision Exercises

Concurrent & Distributed Systems Supervision Exercises Concurrent & Distributed Systems Supervision Exercises Stephen Kell Stephen.Kell@cl.cam.ac.uk November 9, 2009 These exercises are intended to cover all the main points of understanding in the lecture

More information

Mechanising a type-safe model of multithreaded Java with a verified compiler

Mechanising a type-safe model of multithreaded Java with a verified compiler Mechanising a type-safe model of multithreaded Java with a verified compiler Andreas Lochbihler Digital Asset (Switzerland) GmbH Andreas Lochbihler 2 = Isabelle λ β HOL α Andreas Lochbihler 3 Timeline

More information

Verasco: a Formally Verified C Static Analyzer

Verasco: a Formally Verified C Static Analyzer Verasco: a Formally Verified C Static Analyzer Jacques-Henri Jourdan Joint work with: Vincent Laporte, Sandrine Blazy, Xavier Leroy, David Pichardie,... June 13, 2017, Montpellier GdR GPL thesis prize

More information

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008 Agenda Threads CSCI 444/544 Operating Systems Fall 2008 Thread concept Thread vs process Thread implementation - user-level - kernel-level - hybrid Inter-process (inter-thread) communication What is Thread

More information

Multiprocessors & Thread Level Parallelism

Multiprocessors & Thread Level Parallelism Multiprocessors & Thread Level Parallelism COE 403 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and Minerals Presentation Outline Introduction

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2011.3.1 COMPUTER SCIENCE TRIPOS Part IB Monday 6 June 2011 1.30 to 4.30 COMPUTER SCIENCE Paper 3 Answer five questions. Submit the answers in five separate bundles, each with its own cover sheet.

More information

CS 4110 Programming Languages & Logics

CS 4110 Programming Languages & Logics CS 4110 Programming Languages & Logics Lecture 38 Typed Assembly Language 30 November 2012 Schedule 2 Monday Typed Assembly Language Wednesday Polymorphism Stack Types Today Compilation Course Review Certi

More information

Concepts of programming languages

Concepts of programming languages Concepts of programming languages Lecture 5 Wouter Swierstra 1 Announcements Submit your project proposal to me by email on Friday; The presentation schedule in now online Exercise session after the lecture.

More information

Reminder from last time

Reminder from last time Concurrent systems Lecture 5: Concurrency without shared data, composite operations and transactions, and serialisability DrRobert N. M. Watson 1 Reminder from last time Liveness properties Deadlock (requirements;

More information

The Metalanguage λprolog and Its Implementation

The Metalanguage λprolog and Its Implementation The Metalanguage λprolog and Its Implementation Gopalan Nadathur Computer Science Department University of Minnesota (currently visiting INRIA and LIX) 1 The Role of Metalanguages Many computational tasks

More information

Modeling, Testing and Executing Reo Connectors with the. Reo, Eclipse Coordination Tools

Modeling, Testing and Executing Reo Connectors with the. Reo, Eclipse Coordination Tools Replace this file with prentcsmacro.sty for your meeting, or with entcsmacro.sty for your meeting. Both can be found at the ENTCS Macro Home Page. Modeling, Testing and Executing Reo Connectors with the

More information

Lambda Calculus and Type Inference

Lambda Calculus and Type Inference Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ August 17, 2007 Lambda Calculus and Type

More information

15 212: Principles of Programming. Some Notes on Continuations

15 212: Principles of Programming. Some Notes on Continuations 15 212: Principles of Programming Some Notes on Continuations Michael Erdmann Spring 2011 These notes provide a brief introduction to continuations as a programming technique. Continuations have a rich

More information

Programming Kotlin. Familiarize yourself with all of Kotlin s features with this in-depth guide. Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI

Programming Kotlin. Familiarize yourself with all of Kotlin s features with this in-depth guide. Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI Programming Kotlin Familiarize yourself with all of Kotlin s features with this in-depth guide Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI Programming Kotlin Copyright 2017 Packt Publishing First

More information

Lecture #13: Type Inference and Unification. Typing In the Language ML. Type Inference. Doing Type Inference

Lecture #13: Type Inference and Unification. Typing In the Language ML. Type Inference. Doing Type Inference Lecture #13: Type Inference and Unification Typing In the Language ML Examples from the language ML: fun map f [] = [] map f (a :: y) = (f a) :: (map f y) fun reduce f init [] = init reduce f init (a ::

More information

Harvard School of Engineering and Applied Sciences Computer Science 152

Harvard School of Engineering and Applied Sciences Computer Science 152 Harvard School of Engineering and Applied Sciences Computer Science 152 Lecture 17 Tuesday, March 30, 2010 1 Polymorph means many forms. Polymorphism is the ability of code to be used on values of different

More information

Introduction to Multicore Programming

Introduction to Multicore Programming Introduction to Multicore Programming Minsoo Ryu Department of Computer Science and Engineering 2 1 Multithreaded Programming 2 Synchronization 3 Automatic Parallelization and OpenMP 4 GPGPU 5 Q& A 2 Multithreaded

More information

High-Level Small-Step Operational Semantics for Software Transactions

High-Level Small-Step Operational Semantics for Software Transactions High-Level Small-Step Operational Semantics for Software Transactions Katherine F. Moore Dan Grossman The University of Washington Motivating Our Approach Operational Semantics Model key programming-language

More information

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne Chapter 4: Threads Silberschatz, Galvin and Gagne Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Linux Threads 4.2 Silberschatz, Galvin and

More information

Synchronous reactive programming

Synchronous reactive programming Synchronous reactive programming Marcus Sundman Department of Computer Science Åbo Akademi University, FIN-20520 Åbo, Finland e-mail: marcus.sundman@iki.fi URL: http://www.iki.fi/marcus.sundman/ Abstract

More information