Oct. 2012 Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt Istvàn June 2013 –

Slides:



Advertisements
Similar presentations
MINJAE HWANG THAWAN KOOBURAT CS758 CLASS PROJECT FALL 2009 Extending Task-based Programming Model beyond Shared-memory Systems.
Advertisements

Request Scheduling for Multiactive Objects StudentJustine Rochas SupervisorLudovic Henrio Research lab INRIA-I3S-CNRS-UNS Research teamOASIS Master Thesis.
Architecture Representation
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Denis Caromel1 Joint work with Ludovic Henrio – Eric Madelaine et. OASIS members OASIS Team INRIA -- CNRS - I3S – Univ. of Nice Sophia-Antipolis, IUF.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Fabrice Huet Mobility of Active Objects Fabrice Huet INRIA-I3S-CNRS.
1 Johannes Schneider Transactional Memory: How to Perform Load Adaption in a Simple And Distributed Manner Johannes Schneider David Hasenfratz Roger Wattenhofer.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
Transaction Processing: Concurrency and Serializability 10/4/05.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
Chapter 6 – Concurrent Programming Outline 6.1 Introduction 6.2Monitors 6.2.1Condition Variables 6.2.2Simple Resource Allocation with Monitors 6.2.3Monitor.
PARALLEL PROGRAMMING ABSTRACTIONS 6/16/2010 Parallel Programming Abstractions 1.
Modern Concurrency Abstractions for C# by Nick Benton, Luca Cardelli & C´EDRIC FOURNET Microsoft Research.
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
Safe composition of distributed adaptable components A distributed component model Behavioural specification and verification Ludovic Henrio and Eric Madelaine.
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
Oct Active objects: programming and composing safely large-scale distributed applications Ludovic Henrio SCALE team, CNRS – Sophia Antipolis July.
Scientific Computing By: Fatima Hallak To: Dr. Guy Tel-Zur.
Programming and Verifying Distributed and Adaptable Autonomous Components with GCM/ProActive Ludovic Henrio SCALE Team INRIA – UNS – I3S – CNRS Sophia.
1 Update Strategies for First Class Futures Khan Muhammad, Ludovic Henrio INRIA, Univ. Nice Sophia Antipolis,CNRS.
Formalism and Platform for Autonomous Distributed Components Bio-inspired Networks and Services A Distributed Component Model Formalisation in Isabelle.
From Modeling to Deployment of Active Objects - A ProActive backend for ABS Ludovic Henrio, Justine Rochas With the contribution of: Fabrice Huet, Zsolt.
A Locally Nameless Theory of Objects 1.Introduction:  -calculus and De Bruijn notation 2.locally nameless technique 3.formalization in Isabelle and proofs.
ABSTRACT The real world is concurrent. Several things may happen at the same time. Computer systems must increasingly contend with concurrent applications.
Asynchronous Components with Futures: Semantics, Specification, and Proofs in a Theorem Prover Components (Distributed) Futures Formalisations (and proofs)
Denis Caromel1 Institut universitaire de France (IUF) INRIA Sophia-Antipolis – CNRS – I3S – Université de Nice Luis Mateu DCC – Universidad de Chile Eric.
CS333 Intro to Operating Systems Jonathan Walpole.
Using a simple Rendez-Vous mechanism in Java
ICS 313: Programming Language Theory Chapter 13: Concurrency.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
A Component Platform for Experimenting with Autonomic Composition A component framework for supporting composition of autonomic services and bio-inspired.
ASPfun: A Distributed Object Calculus and its Formalization in Isabelle Work realized in collaboration with Florian Kammüller and Henry Sudhof (Technische.
Motivation  Parallel programming is difficult  Culprit: Non-determinism Interleaving of parallel threads But required to harness parallelism  Sequential.
A visualisation and debugging tool for multi-active objects Ludovic Henrio, Justine Rochas LAMHA, Nov 2015.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
Threads and Singleton. Threads  The JVM allows multiple “threads of execution”  Essentially separate programs running concurrently in one memory space.
Transparent First-class Futures and Distributed Components Introduction: components, futures, and challenges Statically Representing Futures An Example.
Lecture 3 Concurrency and Thread Synchronization     Mutual Exclusion         Dekker's Algorithm         Lamport's Bakery Algorithm.
Parallelization Geant4 simulation is an embarrassingly parallel computational problem – each event can possibly be treated independently 1.
A Mechanized Model of the Theory of Objects 1.Functional  -calculus in Isabelle 2.Confluence Proof in Isabelle 3.Ongoing Work, Applications, Conclusion.
Distributed Components and Futures: Models and Challenges A Distributed Component Model Distributed Reconfiguration Calculi for Components and Futures.
A Theory of Distributed Objects Toward a Foundation for Component Grid Platforms Ludovic HENRIO l A Theory of Distributed Objects l Components l Perspectives.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Proving Correctness and Measuring Performance CET306 Harry R. Erwin University of Sunderland.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
GCM/ProActive: a distributed component model, its implementation, and its formalisation Ludovic Henrio OASIS Team INRIA – UNS – I3S – CNRS Sophia Antipolis.
ASYNCHRONOUS AND DETERMINISTIC OBJECTS ASP: Asynchronous Sequential Processes l Distributed objects l Asynchronous method calls l Futures and Wait-by-necessity.
A brief intro to: Parallelism, Threads, and Concurrency
Justine Rochas Thesis supervised by Ludovic Henrio (CNRS)
Why Events Are A Bad Idea (for high-concurrency servers)
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Multicore Programming Final Review
Distributed Components and Futures: Models and Challenges
Threads and Memory Models Hal Perkins Autumn 2011
Threads and Memory Models Hal Perkins Autumn 2009
Background and Motivation
Monitor Object Pattern
Software Transactional Memory Should Not be Obstruction-Free
Programming with Shared Memory Specifying parallelism
CMSC 202 Threads.
Presentation transcript:

Oct Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt Istvàn June 2013 –

Agenda

ASP and ProActive Active objects Asynchronous method calls / requests With implicit transparent futures   WBN!! foo = beta.bar(p) foo.getval( ) Caromel, D., Henrio, L.: A Theory of Distributed Object. Springer-Verlag (2005) A beta = newActive (“A”, …); V foo = beta.bar(param); ….. foo.getval( );

First Class Futures delta.snd(foo)    f

Agenda

Active Objects – Limitations No data sharing – inefficient local parallelism  Parameters of method calls/returned values are passed by value (copied)  No data race-condition simpler programming + easy distribution Risks of deadlocks, e.g. no re-entrant calls  Active object are single threaded  Re-entrance: Active object deadlocks by waiting on itself(except if first-class futures)  Solution: Modifications to the application logic difficult to program

Related Work (1): Cooperative multithreading Creol, ABS, and Jcobox: Active objects & futures Cooperative multithreading l All requests served at the same time l But only one thread active at a time l Explicit release points in the code  can solve the re-entrance problem  More difficult to program: less transparency  Possible interleaving still has to be studied

Related Work (2): JAC Declarative parallelization in Java Expressive (complex) set of annotations “Reactive” objects  Simulating active objects is possible but not trivial

Agenda

Multi-active objects A programming model that mixes local parallelism and distribution with high-level programming constructs Execute several requests in parallel but in a controlled manner add() { … … } monitor() {… … } add() { … } Provided add, add and monitor are compatible join() Note: monitor is compatible with join

Scheduling Requests An « optimal » request policy that « maximizes parallelism »: ➜ Schedule a new request as soon as possible (when it is compatible with all the served ones) ➜ Serve it in parallel with the others ➜ Serves l Either the first request l Or the second if it is compatible with the first one (and the served ones) l Or the third one … compatible

Declarative concurrency by annotating request methods Groups (Collection of related methods) Rules (Compatibility relationships between groups) Memberships (To which group each method belongs)

More efficiency: Thread management Too many threads can be harmful:  memory consumption,  too much concurrency wrt number of cores Possibility to limit the number of threads  Hard limit: strict limit on the number of threads  Soft limit: prevents deadlocks Limit the number of threads that are not in a WBN

Dynamic compatibility: Principle Compatibility may depend on object’s state or method parameters add(int n) { … … } add(int n) { … } Provided the parameters of add are different (for example) join()

Dynamic compatibility: annotations Define a common parameter for methods in a group a comparison function between parameters (+local state) to decide compatibility Returns true if requests compatible

Hypotheses and programming methodology We trust the programmer: annotations supposed correct static analysis or dynamic checks should be applied in the future Without annotations, a multi-active object runs like an active object If more parallelism is required: 1. Add annotations for non-conflicting methods 2. Declare dynamic compatibility 3. Protect some memory access (e.g. by locks) and add new annotations Easy to program Difficult to program

Agenda

Experiment #1: NAS parallel benchmark Pure parallel application (Java) No distribution Comparison with hand-written concurrent code Shows that with multi-active objects, parallel code  Is simpler and shorter  With similar performance

Multi-active objects are simpler to program Original vs. Multi-active object master/slave pattern for NAS

NAS results Less synchronisation/concurrency code With similar performances

Experiment #2: CAN Parallel and distributed Parallel routing Each peer is implemented by a (multi) active object and placed on a machine

Experiment #2: CAN

Agenda

Conclusion (1/2): a new programming model Active object model  Easy to program  Support for distribution Local concurrency and efficiency on multi-cores  Transparent multi-threading  Simple annotations Possibility to write non-blocking re-entrant code Parallelism is maximised:  Two requests served by two different threads are compatible  Each request is incompatible with another request served by the same thread (that precede it)

Implemented multi-active objects above ProActive Dynamic compatibility rules and thread limitation Case studies/benchmarks: NAS, CAN Specified SOS semantics and proved « maximal parallelism » Next steps:  Use the new model (new use-cases and applications)  Prove stronger properties, mechanised formalisaiton  Static guarantees / verification of annotations Conclusion (2/2): Results and Status

Thank you NB: The greek subtitles (i.e. the operational semantics) can be found in our paper Ludovic Henrio, Fabrice Huet, Zsolt Istvàn

27

Active Objects Asynchronous communication with futures Location transparency Composition:  An active object (1)  a request queue (2)  one service thread (3)  Some passive objects (local state) (4)