Components with Symbolic Transition Fabrcio Fernandes, Systems: a - - PowerPoint PPT Presentation

components with symbolic transition
SMART_READER_LITE
LIVE PREVIEW

Components with Symbolic Transition Fabrcio Fernandes, Systems: a - - PowerPoint PPT Presentation

Components with STS : a Java Imple- mentation Components with Symbolic Transition Fabrcio Fernandes, Systems: a Java Implementation Jean-Claude Royer, Robin Passama of Rendezvous Outline Introduction Fabrcio de Alexandria Fernandes


slide-1
SLIDE 1

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Components with Symbolic Transition Systems: a Java Implementation

  • f Rendezvous

Fabrício de Alexandria Fernandes Jean-Claude Royer Robin Passama

École des Mines de Nantes Department of Computer Science – OBASCO Group INRIA Research Centre Rennes - Bretagne Atlantique – LINA

10-07-2007 / CPA 2007

1 / 34

slide-2
SLIDE 2

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

2 / 34

slide-3
SLIDE 3

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction

Motivation Our work

STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

3 / 34

slide-4
SLIDE 4

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction

Motivation Our work

STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Motivation

  • Component Based Software Engineering (CBSE)
  • Explicit protocols integrated to component interfaces to

describe their behaviour in a formal way

  • Need of formal analysis methods to analyze component

interactions

  • Behavioural Interface Description Languages (BIDLs):
  • Architectural analysis and verification issues
  • Relate efficiently design and implementation
  • Problem: explicit protocols are often dissociated from

component code (not ensured that component execution will respect protocols rules)

4 / 34

slide-5
SLIDE 5

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction

Motivation Our work

STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Our work

  • Fill the gap between high-level formal models and

implementation of protocols

  • Ensure consistency between analysis and execution

phases

  • Link between specification or design models and

programming languages: automated translation of models into programming code

  • Long term goal: formal component model with

executable protocols which includes associated tools: an STSLib, a formal ADL and analysis tools

5 / 34

slide-6
SLIDE 6

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model

Introduction Example Rendezvous principle

Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

6 / 34

slide-7
SLIDE 7

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model

Introduction Example Rendezvous principle

Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

STS Model

  • Implementing STS requires to manage different

development steps:

  • Implementing the data part
  • Representing the protocol
  • Gluing the data part and the protocol into a primitive

component (intra-component composition)

  • Implementing components synchronization and

communication (inter-component composition)

  • Primitive component made of ports and a protocol

described in the STS formalism

  • STS: states + transitions between states
  • STS transition general syntax: [guard] event/action
  • guard: condition to trigger the transition
  • event: dynamic event possibly with emission ! or receipt

? (notification of the action execution)

  • action: action to be performed

7 / 34

slide-8
SLIDE 8

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model

Introduction Example Rendezvous principle

Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Example of STS component

8 / 34

slide-9
SLIDE 9

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model

Introduction Example Rendezvous principle

Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Composition architecture

activityIn think think use gives S end / C:=C−1 / C:=C+1 ! gives S:int [C==0] / S, T, C:=0:int / T:=(T+1)%MAXINT ! givet T:int / S:=(S+1)%MAXINT activityOut end end givet end end s: server p1: process p2: process Same STS as p1 ? use S:int [A==S] T / A:=0:int ? think T:int / A:=T E I use

9 / 34

slide-10
SLIDE 10

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model

Introduction Example Rendezvous principle

Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Rendezvous principle

  • Synchronization of several events: triggering them in

any real order but in the same logical time

  • With communication: sender necessarily initiates a

value computation and communicate it to the receivers

  • Primitive components involved in synchronization

cannot trigger any other event during this synchronization

  • Provides execution actions of all the participants and 1

to n communications

  • Guard with receipt: components can conditionally

receive and synchronize on a value in the same logical time

10 / 34

slide-11
SLIDE 11

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

11 / 34

slide-12
SLIDE 12

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Implementation of the STS

  • Dynamic part: states, transitions and some names

(guards, events, receipt variables, senders and actions)

  • Data part: Java class implementing the formal data part

with a real implementation of the names with methods

  • n the state machine part
  • Emitter: pure function computing the emitted value in a

given state of the component

  • Guard: boolean function implementing a condition

12 / 34

slide-13
SLIDE 13

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Implementation of the Process Primitive Component

activityIn / think E I / use / end end activityOut Process.java Data Part STS Protocol } ... extends Data{ class Process Java Interface ? use S:int [check] T ? think T:int Component Interface

13 / 34

slide-14
SLIDE 14

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Rules to Generate Interfaces

  • Translation rules for one emission and one receipt

public void action(Type var); public boolean guard(); public void action(Type var); [guard] event !emitter:Type / action [guard] event ?var:Type / action public Type emitter(); public boolean guard(Type var);

  • Automatic generation from STS to Java squeleton

public interface IProcess { public void think ( int T ) ; public boolean check ( int S ) ; / / check f o r guard (A == S) public void use ( int S ) ; public void end ( ) ; }

14 / 34

slide-15
SLIDE 15

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Java Class for the Process STS

public class Process extends Data implements IProcess { protected int A; public Process ( ) { this .A = 0; } public void think ( int T) { this .A = T ; } / / guard with r ecei pt public boolean check ( int S) { return this .A == S; } / / use action with r ecei pt public void use ( int S) { System . out . p r i n t l n ( " Enter c r i t i c a l section " ) ; } public void end ( ) { System . out . p r i n t l n ( " Leaving c r i t i c a l section " ) ; } } 15 / 34

slide-16
SLIDE 16

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview

Implementation of the STS Implementation of the Process Primitive Component

A Java Imple- mentation of Rendezvous Conclusions

Partial UML Class Diagram

16 / 34

slide-17
SLIDE 17

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

17 / 34

slide-18
SLIDE 18

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Basic Barrier Principles

  • Started with a mechanism to implement the

synchronization of LTSs [Noyé et al, GPCE06]

  • Synchronization possible between two actions with the

same name

  • An arbiter controls that synchronizations are correctly

handled

  • Two synchronization barriers with a Java monitor
  • Our solution: one barrier to enter and other one to leave

18 / 34

slide-19
SLIDE 19

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Basic barrier

# actions : String [] LTS # thread : Thread + void eval() + void run() # counter : int [] # syncValueNumber : int [] + void synchronizeOnEntry(int action) + void synchronizeExit(int action) {synchronized} {synchronized} Arbiter Runnable # arbiter # currentState : int # target : int [] []

19 / 34

slide-20
SLIDE 20

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Synchronization barrier

synchronized public void synchronizeOnEntry ( int action ) { i f ( counter [ action ] < syncValueNumber [ action ] − 1) { counter [ action ]++; / / we are not the l a s t thread try { / / so block wait ( ) ; } catch ( InterruptedException e ) { } } else { counter [ action ]=0; / / we are the l a s t thread n o t i f y A l l ( ) ; / / so wake up a l l } } 20 / 34

slide-21
SLIDE 21

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Sequence Entering the Barrier

s : STS : Arbiter p1 : STS

synchronizeOnEntry() : true wait() synchronizeOnEntry() notify() notify() data.executeAction("gives",v) data.executeAction("use",v) eval()

21 / 34

slide-22
SLIDE 22

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Synchronization vector representation

  • First improvement: relax the restriction on names for

synchronization (reuse purposes)

  • Solution: set of synchronizations vectors each one

represents a possible synchronization between some events

  • Representation by a new class LockSync with the

barrier methods

  • Method isSynchronous to choose one LockSync
  • bject

22 / 34

slide-23
SLIDE 23

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Sequence Entering the Barrier

s : STS : Arbiter lc : LockSync p1 : STS

lc : LockSync = isSynchronous("gives") data.executeGuard("gives") : true synchronizeOnEntry() : true isPossible(lc) : true checkGuards(lc) : true data.executeGuard("gives") : true wait() lc : LockSync = isSynchronous("use") synchronizeOnEntry() notify() notify() data.executeAction("gives",v) data.executeAction("use",v)

23 / 34

slide-24
SLIDE 24

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Independent Synchronizations

  • Problem: synchronization serialized (single arbiter and

entry/exit methods are synchronized)

  • Solution: LockSync class
  • Independent synchronization: one from another iff it

does not belong to its conflict set (Conflict class)

  • Conflict of a synchronization: defined as set of

synchronizations which synchronize on a commom component

  • On the example, synchronizations are mutually

conflicting because of the central server component

24 / 34

slide-25
SLIDE 25

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Sequence Entering the Barrier

s : STS : Flags : Arbiter lc : LockSync p1 : STS

lc : LockSync = isSynchronous("gives") data.executeGuard("gives") : true synchronizeOnEntry() : true isPossible(lc) : true checkGuards(lc) : true data.executeGuard("gives") : true freeze() : true relax() conflict.isFree() : true wait() lc : LockSync = isSynchronous("use") synchronizeOnEntry() notify() notify() data.executeAction("gives",v) data.executeAction("use",v)

25 / 34

slide-26
SLIDE 26

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Guards with Communication

  • Abstract class Data: execution of guards, emitters and

actions on a instance

  • eval method modified to manage synchronous actions

with communication

  • Introduction of the class LockCom (specialization of

LockSync with the communication case)

  • New methods: setEmittedValue to communicate

the values to the LockSync objects; checkGuards to verify if the guards are true; eval modified to retrieve the communicated values

26 / 34

slide-27
SLIDE 27

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Sequence Entering the Barrier

s : STS : Flags : Arbiter lc : LockComm p1 : STS

lc : LockComm = isSynchronous("gives") data.executeGuard("gives") : true v = computeEmittedValue("gives") setEmittedValue(v) synchronizeOnEntry() : true isPossible(lc) : true checkGuards(lc) : true data.executeGuard("gives") : true freeze() : true relax() conflict.isFree() : true wait() lc : LockComm = isSynchronous("use") v = getEmmitedValue("use") synchronizeOnEntry() notify() notify() data.executeAction("gives",v) data.executeAction("use",v)

27 / 34

slide-28
SLIDE 28

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous

Basic Barrier Principles Synchronization barrier Improvements on the mechanism

Conclusions

Partial UML Class Diagram

28 / 34

slide-29
SLIDE 29

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Final remarks

Outline

  • Introduction
  • Motivation
  • Our work
  • STS-Oriented Component Model
  • STS Model
  • Example
  • Model Implementation Overview
  • Implementation of the STS
  • Implementation of the Process primitive component
  • A Java Implementation of Rendezvous
  • Basic Barrier Principles
  • Synchronization Barrier
  • Evolution of the mechanism development
  • Conclusions

29 / 34

slide-30
SLIDE 30

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Final remarks

Related work

  • Use of explicit behavioural protocols
  • PROCOL: sequences of events, data types and guards,

1-1 communication

  • SOFA: sequences of events, synchronous

communications 1-1 RPC calls

  • Cooperative Objects: Petri-Net, data types and guards,

synchronous communications 1-1 RPC calls

  • Finite State Processes (FSP) with Java constructions:

process algebra based CSP , synchronization based on rendezvous mechanism

  • JCSP: provides a CSP model for the Java thread

model, Java library, shared channels to synchronize processes, safer alternative than threads

30 / 34

slide-31
SLIDE 31

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Final remarks

Conclusions

  • Provides an operational interpreter to program primitive

components in Java with STS and a powerful way to compose them

  • Solution providing a mechanism to synchronize

component with protocols

  • Protocols as Symbolic Transition Systems with full data

types, guards and communications (relating verification and execution of component systems)

  • Definition of conditional rendezvous taking into account

the communicated values

31 / 34

slide-32
SLIDE 32

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Final remarks

Future Work

  • Definition of a Java based language with STS,

asynchronous and synchronous communications

  • True usable system: exception handling, barrier
  • ptimizations and RMI
  • Prove the correcteness of the solution

32 / 34

slide-33
SLIDE 33

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Final remarks

Questions?

  • Questions?

33 / 34

slide-34
SLIDE 34

Components with STS : a Java Imple- mentation Fabrício Fernandes, Jean-Claude Royer, Robin Passama Outline Introduction STS-oriented Component Model Model Imple- mentation Overview A Java Imple- mentation of Rendezvous Conclusions

Components with Symbolic Transition Systems: a Java Implementation

  • f Rendezvous

Fabrício de Alexandria Fernandes Jean-Claude Royer Robin Passama

École des Mines de Nantes Department of Computer Science – OBASCO Group INRIA Research Centre Rennes - Bretagne Atlantique – LINA

10-07-2007 / CPA 2007

34 / 34