Implementing Joins using Extensible Pattern Matching

Size: px
Start display at page:

Download "Implementing Joins using Extensible Pattern Matching"

Transcription

1 Implementing Joins using Extensible Pattern Matching Philipp Haller, EPFL joint work with Tom Van Cutsem, Vrije Universiteit Brussel

2 Introduction Concurrency is indispensable: multi-cores, asynchronous, distributed applications Two interesting pieces of the puzzle: Joins: high-level, declarative specification of synchronization constraints (origin: join calculus) Extensible pattern matching constructs of modern languages (e.g., Scala, F#) Idea: integrate join synchronization using extensible pattern matching June 4, 2008 Scala Joins/Haller/COORDINATION'08 2/18

3 Simple buffer in Cω: Example public class Buffer { public async Put(int s); public int Get() & Put(int s) { return s; Asynchronous methods Never block Return unit/void Join operator & Definition of join pattern Exactly one sync method (Get) Multiple async methods (Put) Result returned to caller of sync method June 4, 2008 Scala Joins/Haller/COORDINATION'08 3/18

4 Example using Scala Joins enable join class Buffer extends Joins { patterns val Put = new AsyncEvent[Int] val Get = new SyncEvent[Int] join { case Get() & Put(x) => Get reply x Event types: Asynchronous/synchronous Types of argument(s)/result Multiple sync events per join pattern allowed Reply to sync events explicitly June 4, 2008 Scala Joins/Haller/COORDINATION'08 4/18

5 Reader/Writer Lock Nested class ReaderWriterLock extends Joins { val Exclusive, ReleaseExclusive = new NullarySyncEvent val Shared, ReleaseShared = new NullarySyncEvent private val Sharing = new AsyncEvent[Int] pattern join { case Exclusive() & Sharing(0) => Exclusive.reply() case ReleaseExclusive() => Sharing(0); ReleaseExclusive.reply() case Shared() & Sharing(n) => Sharing(n+1); Shared.reply() case ReleaseShared() & Sharing(n) => Sharing(n-1); ReleaseShared.reply() Sharing(0) Invoking (private) events inside bodies/constructor June 4, 2008 Scala Joins/Haller/COORDINATION'08 5/18

6 Reader/Writer Lock: C# Joins public class ReaderWriter { public Synchronous.Channel Exclusive, ReleaseExclusive; public Synchronous.Channel Shared, ReleaseShared; private Asynchronous.Channel Idle; private Asynchronous.Channel<int> Sharing; public ReaderWriter() { Join j = Join.Create();... // Boilerplate omitted j.when(exclusive).and(idle).do(delegate {); j.when(releaseexclusive).do(delegate{ Idle(); ); j.when(shared).and(idle).do(delegate{ Sharing(1); ); j.when(shared).and(sharing).do(delegate(int n) { Sharing(n+1); ); j.when(releaseshared).and(sharing).do(delegate(int n) { if (n==1) Idle(); else Sharing(n-1); ); Idle(); June 4, 2008 Scala Joins/Haller/COORDINATION'08 6/18

7 Expressiveness of Scala Joins 1. Nested patterns Avoid if-else inside join bodies Less redundancy, fewer messages 2. Guards No need for internal events to maintain state 3. Dynamic joins Beyond compiled schemes, such as Cω Sequence matching Deconstruct sequence inside pattern June 4, 2008 Scala Joins/Haller/COORDINATION'08 7/18

8 Pattern Matching in Scala { case pat 1 => body 1... case pat n => body n class PartialFunction[A,B] extends Function[A,B] { def isdefinedat(x: A): Boolean class Function[A,B] { def apply(x: A): B is compiled to (anonymous) class that extends June 4, 2008 Scala Joins/Haller/COORDINATION'08 8/18

9 Join Patterns as Partial Functions join { case Get() & Put(x) => Get reply x (is compiled to) val pats = new PartialFunction[?, Unit] { def isdefinedat(arg:?): Boolean =... def apply(arg:?): Unit =... join(pats) isdefinedat: check whether a join pattern matches apply: execute body of first matching join pattern June 4, 2008 Scala Joins/Haller/COORDINATION'08 9/18

10 Matching Join Patterns: Example join { case Buy(a, x) & Sell(a, y) =>... & patfun := Buy(a, x) Sell(b, y) a == b Invocations: Matching: (B, U) (A, W) (1, 1) (1, 2) (2, 1) FAIL FAIL MATCH (A, V) (C, V) June 4, 2008 Scala Joins/Haller/COORDINATION'08 10/18

11 Matching Problem Problem: outcome of matching depends on history of event invocations Ex.: When invoking Get, join pattern matches iff Put has been invoked previously Solution join { case Get() & Put(x) => Get reply x Buffer event invocations Consult these buffers during matching For this, use extensible pattern matching! June 4, 2008 Scala Joins/Haller/COORDINATION'08 11/18

12 Extensible Pattern Matching Extractors (Scala), Active Patterns (F#) Implicitly apply type conversions Ex.: (x: Int) match { case Twice(y) => println("x = 2*"+y) case _ => println("x uneven") (is compiled to) Twice.unapply(x) match { case Some(y) => println("x = 2*"+y) case None => println("x uneven") June 4, 2008 Scala Joins/Haller/COORDINATION'08 12/18

13 Matching Join Patterns join { case &(Get(), Put(x)) => Get reply x (is compiled to) new PartialFunction[?, Unit] { def isdefinedat(arg:?) = &.unapply(arg) match { case Some((Get(), Put(x))) => true case _ => false June 4, 2008 Scala Joins/Haller/COORDINATION'08 13/18

14 Matching Join Patterns (2) join { case &(Get(), Put(x)) => Get reply x (is compiled to) new PartialFunction[?, Unit] { def isdefinedat(arg:?) = &.unapply(arg) match { case Some((u, v)) => Get.unapply(u) match { case true => Put.unapply(v) match { case Some(x) => true case _ => false case _ => false case _ => false Permits information to be passed down from & to the events! > Control matching of events June 4, 2008 Scala Joins/Haller/COORDINATION'08 14/18

15 Matching Join Patterns: Example Matching: join { case Buy(a, x) & Sell(a, y) =>... patfun := & Buy(a, x) Sell(b, y) a == b 3. Buy.unapply(c) 4. Sell.unapply(c) (B, U) (A, V) Buffered invocations: return invocation (A, W) (C, V) c(this) 2. c patfun.isdefinedat(c) For each combination (1, 1) c: FAIL call patfun.isdefinedat(c) (1, 2) FAIL (2, 1) MATCH until match found or all combinations have been tried c Evaluate guard June 4, 2008 Scala Joins/Haller/COORDINATION'08 15/18

16 Joins for Actors Enables join patterns alongside normal message patterns: receive { case Put(x) & Get() => Get reply x case Some(other) =>... More general: generalization of existing libraries that use pattern matching By sticking to simple PartialFunction interface Compilation to locks would require adding compiler support for actors! June 4, 2008 Scala Joins/Haller/COORDINATION'08 16/18

17 Ongoing and Future Work Generalization of programming model e.g., mobility of events/join messages Search strategies (e.g., first match) Optimizations Experimental evaluation Compiler plug-in More consistency checks Offline optimization June 4, 2008 Scala Joins/Haller/COORDINATION'08 17/18

18 Scala Joins Exploits extensible pattern matching High expressiveness Nested patterns and guards Dynamic joins Library-based design Enables generalization of existing libraries Strong consistency checks Download: June 4, 2008 Scala Joins/Haller/COORDINATION'08 18/18

An Overview of Scala. Philipp Haller, EPFL. (Lots of things taken from Martin Odersky's Scala talks)

An Overview of Scala. Philipp Haller, EPFL. (Lots of things taken from Martin Odersky's Scala talks) An Overview of Scala Philipp Haller, EPFL (Lots of things taken from Martin Odersky's Scala talks) The Scala Programming Language Unifies functional and object-oriented programming concepts Enables embedding

More information

Implementing Joins using Extensible Pattern Matching

Implementing Joins using Extensible Pattern Matching Implementing Joins using Extensible Pattern Matching Philipp Haller 1, Tom Van Cutsem 2 1 LAMP-REPORT-2007-004 EPFL firstname.lastname@epfl.ch 2 Vrije Universiteit Brussel, Belgium Abstract. Join patterns

More information

Concurrency Abstractions in C#

Concurrency Abstractions in C# Concurrency Abstractions in C# Concurrency critical factor in behavior/performance affects semantics of all other constructs advantages of language vs. library compiler analysis/optimization clarity of

More information

Concurrency Abstractions in C#

Concurrency Abstractions in C# Concurrency Abstractions in C# Concurrency critical factor in behavior/performance affects semantics of all other constructs advantages of language vs. library compiler analysis/optimization clarity of

More information

Concurrency Abstractions in C#

Concurrency Abstractions in C# Concurrency Abstractions in C# 1 1 Motivation Concurrency in C# Concurrency critical factor in behavior/performance affects semantics of all other constructs advantages of language vs. library Compiler

More information

Let s Unify With Scala Pattern Matching!

Let s Unify With Scala Pattern Matching! Let s Unify With Scala Pattern Matching! Edmund S.L. Lam 1 and Iliano Cervesato 1 Carnegie Mellon University Qatar sllam@qatar.cmu.edu and iliano@cmu.edu Abstract Scala s pattern matching framework supports

More information

What the optimizer does to your code

What the optimizer does to your code 1 / 12 Miguel Garcia http://lamp.epfl.ch/~magarcia LAMP, EPFL 2012-04-18 2 / 12 Outline Things the optimizer is good at Example Pros and Cons Early inlining Parallelizing an optimization phase Further

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

CS 6112 (Fall 2011) Foundations of Concurrency

CS 6112 (Fall 2011) Foundations of Concurrency . CS 6112 (Fall 2011) Foundations of Concurrency. 20 October 2011 Scribe: Alec Story.. Actors are a fairly old idea for concurrency, but a lot of the old work is confusing and hard to read. Actors have

More information

AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks

AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks Tom Van Cutsem Programming Technology Lab Vrije Universiteit Brussel Brussels, Belgium LAMP - EPFL, July 25th 2007, Lausanne

More information

Asynchronous Functions in C#

Asynchronous Functions in C# Asynchronous Functions in C# Asynchronous operations are methods and other function members that may have most of their execution take place after they return. In.NET the recommended pattern for asynchronous

More information

Scala Actors. Scalable Multithreading on the JVM. Philipp Haller. Ph.D. candidate Programming Methods Lab EPFL, Lausanne, Switzerland

Scala Actors. Scalable Multithreading on the JVM. Philipp Haller. Ph.D. candidate Programming Methods Lab EPFL, Lausanne, Switzerland Scala Actors Scalable Multithreading on the JVM Philipp Haller Ph.D. candidate Programming Methods Lab EPFL, Lausanne, Switzerland The free lunch is over! Software is concurrent Interactive applications

More information

Advances in Programming Languages

Advances in Programming Languages O T Y H Advances in Programming Languages APL5: Further language concurrency mechanisms David Aspinall (including slides by Ian Stark) School of Informatics The University of Edinburgh Tuesday 5th October

More information

Simplifying Asynchronous Code with

Simplifying Asynchronous Code with Simplifying Asynchronous Code with Scala Async JASON ZAUGG PHILIPP HALLER The Problem Asynchronous code ubiquitous Intrinsic to programming models like actors Required for performance and scalability See

More information

Declarations and Access Control SCJP tips

Declarations and Access Control  SCJP tips Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for

More information

AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks

AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks AmbientTalk: Object-oriented Event-driven programming in Mobile Ad hoc Networks Tom Van Cutsem Stijn Mostinckx Elisa Gonzalez Boix Jessie Dedecker Wolfgang De Meuter Programming Technology Lab Vrije Universiteit

More information

Functional programming

Functional programming Functional programming Functional programming In functional programming, functions are the core building blocks In pure functional programming, functions are like mathematical functions Mathematical functions

More information

Enforcing Mutual Exclusion Using Monitors

Enforcing Mutual Exclusion Using Monitors Enforcing Mutual Exclusion Using Monitors Mutual Exclusion Requirements Mutually exclusive access to critical section Progress. If no process is executing in its critical section and there exist some processes

More information

CompSci 220. Programming Methodology 16: Understanding FP Error Handling Part 2

CompSci 220. Programming Methodology 16: Understanding FP Error Handling Part 2 CompSci 220 Programming Methodology 16: Understanding FP Error Handling Part 2 Objectives Option Composition and Lifting For- Comprehension Expansion The Either Data Type Option and Either in the Standard

More information

Today: Distributed Middleware. Middleware

Today: Distributed Middleware. Middleware Today: Distributed Middleware Middleware concepts Case study: CORBA Lecture 24, page 1 Middleware Software layer between application and the OS Provides useful services to the application Abstracts out

More information

Linguistic Symbiosis between Actors and Threads

Linguistic Symbiosis between Actors and Threads Linguistic Symbiosis between s and Threads Tom Van Cutsem Stijn Mostinckx Wolfgang De Meuter Programming Technology Lab Vrije Universiteit Brussel Brussels, Belgium International Conference on Dynamic

More information

EECS168 Exam 3 Review

EECS168 Exam 3 Review EECS168 Exam 3 Review Exam 3 Time: 2pm-2:50pm Monday Nov 5 Closed book, closed notes. Calculators or other electronic devices are not permitted or required. If you are unable to attend an exam for any

More information

Last Class: Synchronization

Last Class: Synchronization Last Class: Synchronization Synchronization primitives are required to ensure that only one thread executes in a critical section at a time. Concurrent programs Low-level atomic operations (hardware) load/store

More information

Thrift specification - Remote Procedure Call

Thrift specification - Remote Procedure Call Erik van Oosten Revision History Revision 1.0 2016-09-27 EVO Initial version v1.1, 2016-10-05: Corrected integer type names. Small changes to section headers. Table of Contents 1.

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

Models and languages of concurrent computation

Models and languages of concurrent computation Models and languages of concurrent computation Lecture 11 of TDA383/DIT390 (Concurrent Programming) Carlo A. Furia Chalmers University of Technology University of Gothenburg SP3 2016/2017 Today s menu

More information

Lecture 09: Introduction to Scala

Lecture 09: Introduction to Scala Lecture 09: Introduction to Scala Computer Science Department, University of Crete Multicore Processor Programming Based on slides by D. Malayeri, S.D. Vick, P. Haller, and M. Madsen Pratikakis (CSD) Scala

More information

Decision Making in C

Decision Making in C Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed

More information

What should we do with this freedom?

What should we do with this freedom? 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

More information

Capabilities for Uniqueness and Borrowing

Capabilities for Uniqueness and Borrowing Capabilities for Uniqueness and Borrowing Philipp Haller and Martin Odersky EPFL 24 th European Conference on Object Oriented Programming June 24, 2010 Maribor, Slovenia Motivating Example actor { val

More information

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages The Dining Philosophers Problem CMSC 0: Organization of Programming Languages Threads Classic Concurrency Problems Philosophers either eat or think They must have two forks to eat Can only use forks on

More information

SELECTION. (Chapter 2)

SELECTION. (Chapter 2) SELECTION (Chapter 2) Selection Very often you will want your programs to make choices among different groups of instructions For example, a program processing requests for airline tickets could have the

More information

Shacl: Operational Semantics

Shacl: Operational Semantics Shacl: Operational Semantics Joeri De Koster, Tom Van Cutsem Vrije Universiteit Brussel, Pleinlaan 2, B-1050 Brussels, Belgium 1. Operational semantics In this section we describe the operational semantics

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distributed Systems Principles and Paradigms Chapter 09 (version 27th November 2001) Maarten van Steen Vrije Universiteit Amsterdam, Faculty of Science Dept. Mathematics and Computer Science Room R4.20.

More information

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem CMSC 330: Organization of Programming Languages Threads Classic Concurrency Problems The Dining Philosophers Problem Philosophers either eat or think They must have two forks to eat Can only use forks

More information

Problems with Concurrency. February 19, 2014

Problems with Concurrency. February 19, 2014 with Concurrency February 19, 2014 s with concurrency interleavings race conditions dead GUI source of s non-determinism deterministic execution model 2 / 30 General ideas Shared variable Access interleavings

More information

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine. 1 PL/SQL INTRODUCTION SQL does not have procedural capabilities. SQL does not provide the programming techniques of condition checking, looping and branching that is required for data before permanent

More information

Java Threads and intrinsic locks

Java Threads and intrinsic locks Java Threads and intrinsic locks 1. Java and OOP background fundamentals 1.1. Objects, methods and data One significant advantage of OOP (object oriented programming) is data encapsulation. Each object

More information

Objects as Session-Typed Processes

Objects as Session-Typed Processes Objects as Session-Typed Processes Stephanie Balzer and Frank Pfenning Computer Science Department, Carnegie Mellon University AGERE! 2015 The essence of object-orientation 2 The essence of object-orientation

More information

Module 10: Open Multi-Processing Lecture 19: What is Parallelization? The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program

Module 10: Open Multi-Processing Lecture 19: What is Parallelization? The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program Amdahl's Law About Data What is Data Race? Overview to OpenMP Components of OpenMP OpenMP Programming Model OpenMP Directives

More information

Optimizing Higher-Order Functions in Scala

Optimizing Higher-Order Functions in Scala Optimizing Higher-Order Functions in Scala Iulian Dragos EPFL Outline A quick tour of Scala Generalities Extension through libraries Closure translation in Scala Cost Optimizations in the Scala compiler

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

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

Distributed Object-Based. Systems. Chapter 9

Distributed Object-Based. Systems. Chapter 9 Distributed Object-Based Systems Chapter 9 Overview of CORBA The global architecture of CORBA. Object Model The general organization of a CORBA system. Service Collection Query Concurrency Transaction

More information

State Machine Diagrams

State Machine Diagrams State Machine Diagrams Introduction A state machine diagram, models the dynamic aspects of the system by showing the flow of control from state to state for a particular class. 2 Introduction Whereas an

More information

Assertions, pre/postconditions

Assertions, pre/postconditions Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What

More information

Session Scala. Multiparty Session Programming with Scala, Scribble and AMQP.

Session Scala. Multiparty Session Programming with Scala, Scribble and AMQP. Session Scala Multiparty Session Programming with Scala, Scribble and AMQP http://code.google.com/p/session-scala/ Olivier Pernet Imperial College London Lisbon Behavioural Types Workshop April 19th, 2011

More information

Parallel Actor Monitors

Parallel Actor Monitors Parallel Monitors Christophe Scholliers Vrije Universiteit Brussel Pleinlaan 2, Elsene, Belgium cfscholl@vub.ac.be Éric Tanter PLEIAD Laboratory DCC / University of Chile etanter@dcc.uchile.cl Wolfgang

More information

The Trouble with Types

The Trouble with Types The Trouble with Types Martin Odersky EPFL and Typesafe Types Everyone has an opinion on them Industry: Used to be the norm (C/C++, Java). Today split about evenly with dynamic. Academia: Static types

More information

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

A Formal Model for Direct-style Asynchronous Observables

A Formal Model for Direct-style Asynchronous Observables A Formal Model for Direct-style Asynchronous Observables Philipp Haller! KTH Royal Institute of Technology, Sweden!! Heather Miller! EPFL, Switzerland!! 27th Nordic Workshop on Programming Theory (NWPT)!

More information

Process Synchronization

Process Synchronization Process Synchronization Concurrent access to shared data may result in data inconsistency Multiple threads in a single process Maintaining data consistency requires mechanisms to ensure the orderly execution

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications Distributed Objects and Remote Invocation Programming Models for Distributed Applications Extending Conventional Techniques The remote procedure call model is an extension of the conventional procedure

More information

Java Threads. COMP 585 Noteset #2 1

Java Threads. COMP 585 Noteset #2 1 Java Threads The topic of threads overlaps the boundary between software development and operation systems. Words like process, task, and thread may mean different things depending on the author and the

More information

Buy a Feature: an Adventure in Immutability and Actors. David Pollak BayFP August 22, 2008

Buy a Feature: an Adventure in Immutability and Actors. David Pollak BayFP August 22, 2008 Buy a Feature: an Adventure in Immutability and Actors David Pollak BayFP August 22, 2008 David Pollak Not strict, but pretty lazy Lead developer for Lift web framework Scala since November 2006, Ruby/Rails,

More information

Remote Procedure Call

Remote Procedure Call Remote Procedure Call Suited for Client-Server structure. Combines aspects of monitors and synchronous message passing: Module (remote object) exports operations, invoked with call. call blocks (delays

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Multithreading Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to large compute clusters Can perform multiple

More information

Communication. Outline

Communication. Outline COP 6611 Advanced Operating System Communication Chi Zhang czhang@cs.fiu.edu Outline Layered Protocols Remote Procedure Call (RPC) Remote Object Invocation Message-Oriented Communication 2 1 Layered Protocols

More information

Interprocess Communication By: Kaushik Vaghani

Interprocess Communication By: Kaushik Vaghani Interprocess Communication By: Kaushik Vaghani Background Race Condition: A situation where several processes access and manipulate the same data concurrently and the outcome of execution depends on the

More information

Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd

Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd 1. Introduction Writing correct concurrent programs using shared data and locks is

More information

Today: Distributed Objects. Distributed Objects

Today: Distributed Objects. Distributed Objects Today: Distributed Objects Case study: EJBs (Enterprise Java Beans) Case study: CORBA Lecture 23, page 1 Distributed Objects Figure 10-1. Common organization of a remote object with client-side proxy.

More information

Topic VIII. The state of the art Scala < > Scala By Example by M. Odersky. Programming Methods Laboratory, EPFL, 2008.

Topic VIII. The state of the art Scala <  > Scala By Example by M. Odersky. Programming Methods Laboratory, EPFL, 2008. References: Topic VIII The state of the art Scala < www.scala-lang.org > Scala By Example by M. Odersky. Programming Methods Laboratory, EPFL, 2008. An overview of the Scala programming language by M.

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2018 Lecture 7b Andrew Tolmach Portland State University 1994-2018 Dynamic Type Checking Static type checking offers the great advantage of catching errors early And

More information

Functions and Objects. Week 7: Symbolic Computation

Functions and Objects. Week 7: Symbolic Computation Week 7: Symbolic Computation In the previous weeks, we've seen the essential elements of modern functional programming: Functions (rst class) Types (parametric) Pattern Matching Lists This week, we'll

More information

PL/SQL Block structure

PL/SQL Block structure PL/SQL Introduction Disadvantage of SQL: 1. SQL does t have any procedural capabilities. SQL does t provide the programming technique of conditional checking, looping and branching that is vital for data

More information

Informatica 3. Marcello Restelli. Laurea in Ingegneria Informatica Politecnico di Milano 9/15/07 10/29/07

Informatica 3. Marcello Restelli. Laurea in Ingegneria Informatica Politecnico di Milano 9/15/07 10/29/07 Informatica 3 Marcello Restelli 9/15/07 10/29/07 Laurea in Ingegneria Informatica Politecnico di Milano Structuring the Computation Control flow can be obtained through control structure at instruction

More information

Submit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time. No late submissions will be accepted.

Submit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time. No late submissions will be accepted. Instructions: For all questions, assume that any necessary header files have been included. Submit your answers to these questions to the Curator under Quizzes as HW08 by the posted due date and time.

More information

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

Distributed Object-Based Systems The WWW Architecture Web Services Handout 11 Part(a) EECS 591 Farnam Jahanian University of Michigan. Distributed Object-Based Systems The WWW Architecture Web Services Handout 11 Part(a) EECS 591 Farnam Jahanian University of Michigan Reading List Remote Object Invocation -- Tanenbaum Chapter 2.3 CORBA

More information

CSCI 447 Operating Systems Filip Jagodzinski

CSCI 447 Operating Systems Filip Jagodzinski Filip Jagodzinski Announcements Homework 2 you have 2 weeks start now Book questions including two custom ones A single programming task File names and directories, class conventions homework2-script,

More information

Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example

Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example Overview Elements of Programming Languages Lecture 11: Object-oriented functional programming James Cheney University of Edinburgh October 30, 2017 We ve now covered: basics of functional programming (with

More information

David Pollak CUFP September 26 th, 2008

David Pollak CUFP September 26 th, 2008 Buy a Feature Adventure in Immutability and Actors David Pollak CUFP September 26 th, 2008 David Pollak Not strict, but pretty lazy Lead developer for Lift web framework Scala since November 2006, Ruby/Rails,

More information

Joint Entity Resolution

Joint Entity Resolution Joint Entity Resolution Steven Euijong Whang, Hector Garcia-Molina Computer Science Department, Stanford University 353 Serra Mall, Stanford, CA 94305, USA {swhang, hector}@cs.stanford.edu No Institute

More information

CMSC 330: Organization of Programming Languages. Threads Classic Concurrency Problems

CMSC 330: Organization of Programming Languages. Threads Classic Concurrency Problems : Organization of Programming Languages Threads Classic Concurrency Problems The Dining Philosophers Problem Philosophers either eat or think They must have two forks to eat Can only use forks on either

More information

Concurrent Programming using Threads

Concurrent Programming using Threads Concurrent Programming using Threads Threads are a control mechanism that enable you to write concurrent programs. You can think of a thread in an object-oriented language as a special kind of system object

More information

SSEA Computer Science: Track A. Dr. Cynthia Lee Lecturer in Computer Science Stanford

SSEA Computer Science: Track A. Dr. Cynthia Lee Lecturer in Computer Science Stanford SSEA Computer Science: Track A Dr. Cynthia Lee Lecturer in Computer Science Stanford Topics for today Introduce Java programming language Assignment and type casting Expressions Operator precedence Code

More information

Parallel And Distributed Compilers

Parallel And Distributed Compilers Parallel And Distributed Compilers Parallel Systems Parallel System has the goal to solve a given problem using multiple processors. Normally Solve a single problem These typically are used in applications

More information

Parallel Actor Monitors: Disentangling Task-Level Parallelism from Data Partitioning in the Actor Model.

Parallel Actor Monitors: Disentangling Task-Level Parallelism from Data Partitioning in the Actor Model. Parallel Actor Monitors: Disentangling Task-Level Parallelism from Data Partitioning in the Actor Model. Christophe Scholliers a,1,, Éric Tanter b,2, Wolfgang De Meuter a a Software Languages Lab, Vrije

More information

Combining Concurrency Abstractions

Combining Concurrency Abstractions Combining Concurrency Abstractions Philipp Haller Typesafe, Switzerland Correctly and Efficiently Combining Concurrency Abstractions Philipp Haller Typesafe, Switzerland The Problem Tendency to combine

More information

Chapter 13 Topics. Introduction. Introduction

Chapter 13 Topics. Introduction. Introduction Chapter 13 Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Java Threads C# Threads Statement-Level Concurrency Copyright 2006 Pearson Addison-Wesley. All rights reserved.

More information

Concurrent Programming. CS105 Programming Languages Supplement

Concurrent Programming. CS105 Programming Languages Supplement Concurrent Programming CS105 Programming Languages Supplement Outline Introduction Categories Concepts Semaphores Monitors Message Passing Statement level concurrency Introduction Definitions Process:

More information

Resource management. Real-Time Systems. Resource management. Resource management

Resource management. Real-Time Systems. Resource management. Resource management Real-Time Systems Specification Implementation Verification Mutual exclusion is a general problem that exists at several levels in a real-time system. Shared resources internal to the the run-time system:

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Type Inference Some statically typed languages, like ML (and to a lesser extent Scala), offer alternative

More information

1 Process Coordination

1 Process Coordination COMP 730 (242) Class Notes Section 5: Process Coordination 1 Process Coordination Process coordination consists of synchronization and mutual exclusion, which were discussed earlier. We will now study

More information

Actors in the Small. Making Actors more Useful. Bill La

Actors in the Small. Making Actors more Useful. Bill La Actors in the Small Making Actors more Useful Bill La Forge laforge49@gmail.com @laforge49 Actors in the Small I. Introduction II. Making Actors Fast III.Making Actors Easier to Program IV. Tutorial I.

More information

C Programming for Engineers Functions

C Programming for Engineers Functions C Programming for Engineers Functions ICEN 360 Spring 2017 Prof. Dola Saha 1 Introduction Real world problems are larger, more complex Top down approach Modularize divide and control Easier to track smaller

More information

Distributed Deadlock Detection

Distributed Deadlock Detection Distributed Deadlock Detection Slides are based on the book chapter from Distributed Computing: Principles, Algorithms and Systems (Chapter 10) by Kshemkalyani and Singhal Pradipta De pradipta.de@sunykorea.ac.kr

More information

Akka Streams and Bloom Filters

Akka Streams and Bloom Filters Akka Streams and Bloom Filters Or: How I learned to stop worrying and love resilient elastic distributed real-time transaction processing using space efficient probabilistic data structures The Situation

More information

Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads.

Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads. Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads. Poor co-ordination that exists in threads on JVM is bottleneck

More information

Lecture08: Scope and Lexical Address

Lecture08: Scope and Lexical Address Lecture08: Scope and Lexical Address Free and Bound Variables (EOPL 1.3.1) Given an expression E, does a particular variable reference x appear free or bound in that expression? Definition: A variable

More information

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017 Java Methods Lecture 8 COP 3252 Summer 2017 May 23, 2017 Java Methods In Java, the word method refers to the same kind of thing that the word function is used for in other languages. Specifically, a method

More information

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Concurrency can occur at four levels: 1. Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Because there are no language issues in instruction- and program-level

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

Overview. Elements of Programming Languages. Objects. Self-Reference

Overview. Elements of Programming Languages. Objects. Self-Reference Overview Elements of Programming Languages Lecture 10: James Cheney University of Edinburgh October 23, 2017 Last time: programming in the large Programs, packages/namespaces, importing Modules and interfaces

More information

Scala in Martin Odersky

Scala in Martin Odersky Scala in 2016 - Martin Odersky 2015 was on the quiet side Maturing tools: 2.11.x, IDEs, sbt Steady growth indeed.com jobs google trends In 2016, things will move again Scala 2.12 release Rethinking the

More information

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

Summary Semaphores. Passing the Baton any await statement. Synchronisation code not linked to the data Lecture 4 Monitors Summary Semaphores Good news Simple, efficient, expressive Passing the Baton any await statement Bad news Low level, unstructured omit a V: deadlock omit a P: failure of mutex Synchronisation

More information

The SPIN Model Checker

The SPIN Model Checker The SPIN Model Checker Metodi di Verifica del Software Andrea Corradini Lezione 1 2013 Slides liberamente adattate da Logic Model Checking, per gentile concessione di Gerard J. Holzmann http://spinroot.com/spin/doc/course/

More information

Intermediate representations IR #1: CPS/L 3. Code example. Advanced Compiler Construction Michel Schinz

Intermediate representations IR #1: CPS/L 3. Code example. Advanced Compiler Construction Michel Schinz Intermediate representations Intermediate representations Advanced Compiler Construction Michel Schinz 2016 03 03 The term intermediate representation (IR) or intermediate language designates the data-structure(s)

More information

learning objectives learn about variables, their types and their values learn about different number representations

learning objectives learn about variables, their types and their values learn about different number representations programming basics learning objectives algorithms your software system software hardware learn about variables, their types and their values learn about different number representations learn boolean algebra

More information