Oct. 2012 Active objects: programming and composing safely large-scale distributed applications Ludovic Henrio SCALE team, CNRS – Sophia Antipolis July.

Slides:



Advertisements
Similar presentations
Elton Mathias and Jean Michael Legait 1 Elton Mathias, Jean Michael Legait, Denis Caromel, et al. OASIS Team INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis,
Advertisements

Request Scheduling for Multiactive Objects StudentJustine Rochas SupervisorLudovic Henrio Research lab INRIA-I3S-CNRS-UNS Research teamOASIS Master Thesis.
Architecture Representation
Denis Caromel1 Joint work with Ludovic Henrio – Eric Madelaine et. OASIS members OASIS Team INRIA -- CNRS - I3S – Univ. of Nice Sophia-Antipolis, IUF.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.
Eric MADELAINE1 E. Madelaine, Antonio Cansado, Emil Salageanu OASIS Team, INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis OSCAR meeting, Valparaiso,
Session 2: task 3.2 GCM, Kracow, June l Current status of GCM Denis Caromel (10 mn each talk) l Wrapping CCA Components as GCM Components Maciej.
1 The SOCK SAGA Ivan Lanese Computer Science Department University of Bologna Italy Joint work with Gianluigi Zavattaro.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Concurrency CS 510: Programming Languages David Walker.
A Case Study in Componentising a Scientific Application for the Grid  Nikos Parlavantzas, Matthieu Morel, Françoise Baude, Fabrice Huet, Denis Caromel,
Constructing Reliable Software Components Across the ORB M. Robert Rwebangira Howard University Future Aerospace Science and Technology.
Communication in Distributed Systems –Part 2
Optimisation of behaviour of component-based distributed systems INRIA - I3S - CNRS – University of Nice Sophia-Antipolis EPC SCALE Galyna Zholtkevych.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
Asynchronous Components Asynchronous communications: from calculi to distributed components.
Safe composition of distributed adaptable components A distributed component model Behavioural specification and verification Ludovic Henrio and Eric Madelaine.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
INRIA Sophia-Antipolis, Oasis team INRIA Rhône-Alpes, Vasy team Feria–IRIT/LAAS, SVF team Toulouse GET - ENST Paris, LTCI team FIACRE Models and Tools.
Formal Models for Programming and Composing Correct Distributed Systems Jury : Gordon BlairFabienne BoyerEric Madelaine Pascal PoizatMichel RiveillDavide.
Oct Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt Istvàn June 2013 –
The Grid Component Model: an Overview “Proposal for a Grid Component Model” DPM02 “Basic Features of the Grid Component Model (assessed)” -- DPM04 CoreGrid.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
The Grid Component Model and its Implementation in ProActive CoreGrid Network of Excellence, Institute on Programming Models D.PM02 “Proposal for a Grid.
Programming and Verifying Distributed and Adaptable Autonomous Components with GCM/ProActive Ludovic Henrio SCALE Team INRIA – UNS – I3S – CNRS Sophia.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
Formalism and Platform for Autonomous Distributed Components Bio-inspired Networks and Services A Distributed Component Model Formalisation in Isabelle.
Eric Madelaine FORTE ’04 -- Madrid sept /25 Parameterized Models for Distributed Java Objects Eric Madelaine work with Tomás Barros, Rabéa Boulifa.
Eric MadelaineOSMOSE -- WP2 -- Prague June 2004 Models for the Verification of Distributed Java Objects Eric Madelaine work with Tomás Barros, Rabéa Boulifa,
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.
Eric MADELAINE1 T. Barros, L. Henrio, E. Madelaine OASIS Team, INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis (FACS’05), Fractal workshop, Grenoble.
A graphical specification environment for GCM component-based applications INRIA – I3S – CNRS – University of Nice-Sophia Antipolis EPC OASIS Oleksandra.
Asynchronous Components with Futures: Semantics, Specification, and Proofs in a Theorem Prover Components (Distributed) Futures Formalisations (and proofs)
A Mechanized Model for CAN Protocols Context and objectives Our mechanized model Results Conclusions and Future Works Francesco Bongiovanni and Ludovic.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
Behavioural Verification of Distributed Components Ludovic Henrio and Eric Madelaine ICE Florence 1.
Behavioural Verification of Distributed Components Ludovic Henrio and Eric Madelaine ICE
Grid programming with components: an advanced COMPonent platform for an effective invisible grid © GridCOMP Grids Programming with components.
Grid programming with components: an advanced COMPonent platform for an effective invisible grid © 2006 GridCOMP Grids Programming with components. An.
FDT Foil no 1 On Methodology from Domain to System Descriptions by Rolv Bræk NTNU Workshop on Philosophy and Applicablitiy of Formal Languages Geneve 15.
1. 2 Objects to Distributed Components (1) Typed Group Java or Active Object ComponentIdentity Cpt = newActiveComponent (params); A a = Cpt ….getFcInterface.
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.
Parameterized Models for Distributed Java Objects Tomás Barros & Rabéa Boulifa OASIS Project INRIA Sophia Antipolis April 2004.
A visualisation and debugging tool for multi-active objects Ludovic Henrio, Justine Rochas LAMHA, Nov 2015.
Transparent First-class Futures and Distributed Components Introduction: components, futures, and challenges Statically Representing Futures An Example.
Eric MADELAINE ---- OASIS1 E. Madelaine Oasis team INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis RESECO ’08 Santiago – Nov. 24, 2008 Specification.
Eric MADELAINE1 A. Cansado, L. Henrio, E. Madelaine OASIS Team, INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis Fractal workshop, Nantes, 3 july.
RESECO - Montevideo - 22 nov 2007Reseco, Montevideo, 22 nov 2007 Eric Madelaine - OASIS Team1 Specifying and Generating Safe GCM Components INRIA – Sophia.
VERIFYING THE CORRECT COMPOSITION OF DISTRIBUTED COMPONENTS: FORMALISATION AND TOOL Ludovic Henrio 1, Oleksandra Kulankhina 1,2, Dongqian Liu 3, Eric Madelaine.
1 ProActive GCM – CCA Interoperability Maciej Malawski, Ludovic Henrio, Matthieu Morel, Francoise Baude, Denis Caromel, Marian Bubak Institute of Computer.
Specifying Fractal and GCM Components With UML Solange Ahumada, Ludovic Apvrille, Tomás Barros, Antonio Cansado, Eric Madelaine and Emil Salageanu SCCC.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Tomás BarrosMonday, April 18, 2005FIACRE Toulouse p. 1 Behavioural Models for Hierarchical Components Tomás Barros, Ludovic Henrio and Eric Madelaine.
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.
Eric MADELAINE -- GridComp -- OASIS 1 E. Madelaine (A. Cansado) GridComp project OASIS team INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis GridComp.
Eric MADELAINE1 T. Barros, L. Henrio, E. Madelaine OASIS Team, INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis DCC, University.
GCM/ProActive: a distributed component model, its implementation, and its formalisation Ludovic Henrio OASIS Team INRIA – UNS – I3S – CNRS Sophia Antipolis.
2. CALCULUS: A S P. A Theory of Distributed Objects D. Caromel, L. Henrio, Springer 2005, Monograph A Calculus: ASP: Asynchronous Sequential Processes.
Formal Models for Programming and Composing Correct Distributed Systems Ludovic Henrio OASIS Team INRIA – UNS – I3S – CNRS Sophia Antipolis.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Justine Rochas Thesis supervised by Ludovic Henrio (CNRS)
Behavioural Models for Distributed Hierarchical Components
Distributed Components and Futures: Models and Challenges
The Grid Component Model and its Implementation in ProActive
Presentation transcript:

Oct Active objects: programming and composing safely large-scale distributed applications Ludovic Henrio SCALE team, CNRS – Sophia Antipolis July 2014 – Middlesex University, London

About the SCALE team Distributed applications are:  Difficult to program safely (correctness)  Difficult to program and run efficiently (efficient deployment running and synchronisation) In the scale team we propose:  Languages: active object, asynchronous processes  Design support: Vercors – specification and verification of distributed components  Runtime support: a Java middleware, and VM placement algorithms Application domains: cloud computing, service oriented computing …

My objective Help the programmer write correct distributed applications and run them safely. By designing languages and middlewares By proving their properties By providing tools to support the development and proof of correct programs 3

Agenda

How to program distributed systems? By programming different entities Each entity should be independent from the others: from a data point of view: data distribution from an execution point of view: decoupled entities, asynchronous interactions Different similar paradigms: actors, active objects, reactive programming, service oriented programming 5

Active objects: generalities Asynchronous method calls / requests No race condition: each object manipulated by a single thread   WBN!! Result foo = beta.bar(p) foo.getval( ) Caromel, D., Henrio, L.: A Theory of Distributed Object. Springer-Verlag (2005) Result

ASP/ProActive Principles Active and Passive objects Request queue (FIFO) Implicit transparent futures Only two kinds of shared references: Active objects and Futures 7 foo   beta.foo(b) Request invocation A beta = newActive (“A”, …); V result = beta.foo(b); ….. result.getval( );

ASP/ProActive Principles Active and Passive objects Request queue (FIFO) Implicit transparent futures Only two kinds of shared references: Active objects and Futures result=beta.foo(b) foo  beta.foo(b) result f  Request invocation

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

First Class Futures delta.snd(result)   

ASP 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

Other active object models: 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

Other approaches Actors (~1985) vs. Active objects  Functional vs. OO programming -> sending messages vs. Remote method invocation  Actors do not use futures (callbacks) -> more difficult to program but no deadlock  Instead of using state variables actor can change the way they react to incoming message (become) JAC (Java annotations for concurrency)  Declarative parallelization in Java  Expressive (complex) set of annotations 13

Agenda

Multi-active objects (with Fabrice Huet and Zsolt Istvan) 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

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

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

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

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 hardLimit=false) V v = o.bar();(1) v.foo();(2) V v = o.bar();(1) v.foo();(2) current thread other thread (1) (2)

Prioritizing waiting (compatible) requests 21 ({ = {" G1 = {" G2 = {" G5 "," G4 = {" G3 = {" G2 "}) ({ = {" G1 = {" G2 = {" G5 "," G4 = {" G3 = {" G2 "}) }) G2 G3 G4G5 incoming request R2 Low priority dependency R4 R3 R1 Priorities are automatically taken into account in the scheduling policy

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

Expriment #1: NPB Multi-active objects are simpler to program Original vs. Multi-active object master/slave pattern for NAS

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

Agenda

What is a component? / Why components? Piece of code (+data) encapsulated with well defined interfaces [Szyperski 2002] Very interesting for reasoning on programs (and for formal methods) because:  components encapsulate isolated code  compositional approach (verification, …)  interaction (only) through interfaces  well identified interaction  easy and safe composition  Reasoning and programming is easier and compositional

What are Components? 27 Business code Primitive component Server / input Client / output

What are Components? 28 Business code Primitive component Business code Primitive component Composite component  Grid Component Model (GCM) An extension of Fractal for Distributed computing  Grid Component Model (GCM) An extension of Fractal for Distributed computing GCM: A Grid Extension to Fractal for Autonomous Distributed Components - F. Baude, D. Caromel, C. Dalmasso, M. Danelutto, V. Getov, L. Henrio, C. Pérez - Annals of Telecom

GCM: “Asynchronous” Fractal Components Add distribution to Fractal components Many-to-many communications ProActive/GCM implemented in the GridCOMP European project, basedon active objects:  No shared memory between components  Components evolve asynchronously  Components communicate by request/replies (Futures)

Discussion: what is a Good size for a (primitive) Component? Not a strict requirement, but somehow imposed by the model design According to CCA or SCA, a service (a component contains a provided business function) According to Fractal, a few objects According to GCM, a process 30  In GCM/ProActive, 1 Component (data/code unit) = 1 Active object (1 thread = unit of concurrency) = 1 Location (unit of distribution)  In GCM/ProActive, 1 Component (data/code unit) = 1 Active object (1 thread = unit of concurrency) = 1 Location (unit of distribution)

A Primitive GCM Component CI.foo(p) CI 31  Primitive components communicate by asynchronous requests on interfaces  Components abstract away distribution and concurrency  In ProActive/GCM a primitive component is an active object  Primitive components communicate by asynchronous requests on interfaces  Components abstract away distribution and concurrency  In ProActive/GCM a primitive component is an active object

Futures for Components 32 f=CI.foo(p) ………. g=f+3 Component are independent entities (threads are isolated in a component) + Asynchronous requests with results  Futures are necessary Component are independent entities (threads are isolated in a component) + Asynchronous requests with results  Futures are necessary 1 2 3

First-class Futures and Hierarchy … … … Without first-class futures, one thread is systematically blocked in the composite component. A lot of blocked threads Without mulit-active objects  systematic deadlock Without first-class futures, one thread is systematically blocked in the composite component. A lot of blocked threads Without mulit-active objects  systematic deadlock return C1.foo(x) 33

Collective interfaces One-to-many = multicast Many-to-one = gathercast Distribution and synchronisation/collection policies for invocation and results Business code Primitive component Business code Primitive component Composite component Business code Primitive component Business code Primitive component 34

Adaptation in the GCM Functional adaptation: adapt the architecture + behaviour of the application to new requirements/objectives/environment Non-functional adaptation(with Paul Naoumenko): adapt the architecture of the container+middleware to changing environment/NF requirements (QoS …) Additional support for reconfiguration (with Marcela Rivera): A stopping algorithm for GCM components A Scripting language for reconfiguring distributed components 35 A Component Platform for Experimenting with Autonomic Composition Françoise Baude, Ludovic Henrio, and Paul Naoumenko. Autonomics Both functional and non-functional adaptation are expressed as reconfigurations Language support for distributed reconfiguration: GCM-script A platform for designing and running autonomic components (with Cristian Ruz) Programming distributed and adaptable autonomous components—the GCM/ProActive framework Françoise Baude, Ludovic Henrio, and Cristian Ruz Software: Practice and Experience Both functional and non-functional adaptation are expressed as reconfigurations Language support for distributed reconfiguration: GCM-script A platform for designing and running autonomic components (with Cristian Ruz) Programming distributed and adaptable autonomous components—the GCM/ProActive framework Françoise Baude, Ludovic Henrio, and Cristian Ruz Software: Practice and Experience

Agenda

What are Formal Methods (here)? Mathematical techniques for developping computer- based systems:  Programs  Languages  Systems What tools?  Pen and paper (PP)  Theorem proving (TP) = proof assistant  Model checking (MC) = check a formula on (an abstraction of) all possible executions  Static analysis  … 37

My general approach 38 Programming model and definitions Correctness & Optimizations Correctness & Optimizations Implementation Correctness & Optimizations Correctness & Optimizations Verification and tools GenericpropertiesGenericproperties  Increase the confidence people have in the system  Help my colleagues implement correct (and efficient) middlewares  Help the programmer write, compose, and run correct and efficient distributed programs  Increase the confidence people have in the system  Help my colleagues implement correct (and efficient) middlewares  Help the programmer write, compose, and run correct and efficient distributed programs

A Framework for Reasoning on Components Formalise GCM in a theorem prover (Isabelle/HOL ) Component hierarchical Structure Bindings, etc… Design Choices  Suitable abstraction level  Suitable representation (List / Finite Set, etc …) Basic lemmas on component structure 39 Business code Primitive component Composite componentGenericpropertiesGenericproperties

A semantics of Primitive Components Primitive components are defined by interfaces plus an internal behaviour, they can:  emit requests  serve requests  send results  receive results (at any time)  do internal actions some rules define a correct behaviour, e.g. one can only send result for a served request 40

A refined GCM model in Isabelle/HOL More precise than GCM, give a semantics to the model:  asynchronous communications: future / requests  request queues  no shared memory between components  notion of request service More abstract than ProActive/GCM  can be multithreaded  no active object, not particularly object-oriented 41 Similarities with: SCA and Fractal (structure), Creol (futures) A guide for implementing and proving properties of component middlewares “certified” by a theorem prover A guide for implementing and proving properties of component middlewares “certified” by a theorem prover

Motivating example: What Can Create Deadlocks in ProActive/GCM? A race condition: Detecting deadlocks can be difficult  behavioural specification and verification techniques Verification and tools

How to ensure the correct behaviour of a given program? Theorem proving too complicated for the ProActive programmer Our approach: behavioural specification 43 Service methods pNets: Behavioural Models for Distributed Fractal Components Antonio Cansado, Ludovic Henrio, and Eric Madelaine - Annals of Telecommunications  Trust the implementation step  Or static analysis  Generate correct (skeletons of) components (+static and/or runtime checks)  Trust the implementation step  Or static analysis  Generate correct (skeletons of) components (+static and/or runtime checks)

Use-case: Fault-tolerant storage 44 1 multicast interface sending write/read/commit requests to all slaves. the slaves reply asynchronously, the master only needs enough coherent answers to terminate Verifying Safety of Fault-Tolerant Distributed Components Rabéa Ameur-Boulifa, Raluca Halalai, Ludovic Henrio, and Eric Madelaine - FACS 2011

Full picture: a pNet !Q_Write(b) ?Q_Write(x) Support for parameterised families Synchronisation vectors 45

Basic pNets: parameterized LTS 46 Labelled transition systems, with: Value passing Local variables Guards…. Can be written as a UML diagram Eric MADELAINE

Properties proved Reachability: 1- The Read service can terminate  fid:nat among {0...2}. ∃ b:bool. true 2- Is the BFT hypothesis respected by the model ? true Inevitability: After receiving a Q_Write(f,x) request, it is (fairly) inevitable that the Write services terminates with a R_Write(f) answer, or an Error is raised. Functional correctness: After receiving a ?Q_Write(f1,x), and before the next ?Q_Write, a ?Q_Read requests raises a !R_Read(y) response, with y=x (written in mu-calculus or Model Checking Language (MCL), Mateescu et al, FM’08) 47 Prove  generic properties like absence of deadlock  or properties specific to the application logic Prove  generic properties like absence of deadlock  or properties specific to the application logic

Modelling architecture + behaviour 48 Modelling platform: An environment for designing and proving correctness of GCM/ProActive components Based on the Obeo Designer platform (Eclipse) Challenge: integrate Fractal/GCM DSL with UML diagrams Executable code and behavioural model generation

CONCLUSION AND CURRENT WORKS 49

Conclusion (1/2)

Conclusion (2/2) (Multi)active objects are very convenient for implementing services and components Active objects unify the notions of: thread(s), service, unit of distribution Formal methods should help writing correct programs Our approach: generic properties + behavioural verification of programs 51

Next steps / hot topics Have a complete tool chain for the design and verification of distributed components (Vercors) Formally specify and reason on multi-active objects:  Semantics specified  Formalisation in Isabelle/HOL with Florian Kammueller  Behavioural specification [TODO] … Implementation and support for Multi-active objects (with Justine Rochas)  An ABS backend in ProActive  Fault tolerance and recovery 52

Thank you

54

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)