A formal approach to autonomic systems programming: The SCEL Language
Italian Conference on TCS 17-19 September 2014, Perugia, Italy
- R. De Nicola - IMT Lucca
Presenting work done in collaboration with:
- M. Loreti, R. Pugliese, F. Tiezzi
A formal approach to autonomic systems programming: The SCEL - - PowerPoint PPT Presentation
A formal approach to autonomic systems programming: The SCEL Language Italian Conference on TCS 17-19 September 2014, Perugia, Italy R. De Nicola - IMT Lucca Presenting work done in collaboration with: M. Loreti, R. Pugliese, F. Tiezzi
1/51
◮ massive numbers of components ◮ complex interactions among components, and other systems ◮ operating in open and non-deterministic environments ◮ dynamically adapting to new requirements, technologies and
◮ the dimension of the systems ◮ the need to adapt to changing environments and requirements ◮ the emergent behaviour resulting from complex interactions ◮ the uncertainty during design-time and run-time
Motivations
2/51
Motivations
3/51
◮ monitoring their behaviour (self-awareness) and their working
◮ analysing the acquired knowledge to identify changes ◮ planning reconfigurations ◮ executing plan actions
Knowledge Monitor Analyze Plan Execute Motivations
4/51
Motivations
5/51
◮ traditional software engineering approaches ◮ techniques from the areas of autonomic, adaptive,
◮ formal methods to guarantee systems properties
Industrial Community Formal Methods Community Software Engineering and Autonomic Systems Communities Highly innovative results Real-world practical challenges Real-world practical challenges Inspiration through pragmatic approaches Inspiration through methods and techniques
Motivations
6/51
◮ Autonomic Components have an interface exposing
◮ AC ensembles are not rigid networks but highly flexible
◮ Interaction between ACs is based on attributes and predicates
Motivations
7/51
Motivations
8/51
◮ equipped with a formal semantics ◮ the semantics associates mathematical models to
◮ built on top of the models ◮ logics used to express properties of interest for the
◮ runtime environment ◮ programming framework ◮ verification tools for (qualitative and quantitative)
A formal approach to engineering AS
9/51
◮ SCEL - A Service Component Ensemble Language
◮ Model checking with Spin ◮ Translation into BIP ◮ Simulation and statistical model checking
◮ jRESP - http://jresp.sourceforge.net/ - the runtime
◮ an API permitting using SCEL constructs in Java
◮ a simulation module permitting to simulate SCEL
A formal approach to engineering AS
10/51
◮ Systems must be specified as naturally as possible ◮ distinctive aspects of the domain need to be first-class citizens
◮ high-level abstract models guarantee feasible analysis ◮ the analysis of results is based on system features, not on
A formal approach to engineering AS
11/51
◮ programming abstractions necessary for ◮ directly representing Knowledge, Behaviors and
◮ naturally programming interaction, adaptation and self-
◮ linguistic primitives with solid semantic grounds ◮ To develop logics, tools and methodologies for formal
◮ to establish qualitative and quantitative properties of
A formal approach to engineering AS
12/51
A formal approach to engineering AS
13/51
Programming abstractions for AS
14/51
◮ Tuples, Records ◮ Horn Clause Clauses, ◮ Concurrent Constraints, ◮ . . .
◮ Pattern-matching, Reactive Tuple Spaces ◮ Data Bases Querying ◮ Resolution ◮ Constraint Solving ◮ . . .
Programming abstractions for AS
15/51
◮ Application data: used for the progress of the computation. ◮ Control data: which provide information about the
◮ Add information to a knowledge repository ◮ Retrieve information from a knowledge repository ◮ Withdraw information from a knowledge repository
Programming abstractions for AS
16/51
◮ Adaptation is obtained by retrieving from knowledge
◮ information about the changing environment and the
◮ the code to execute for reacting to these changes - local
◮ Interaction is obtained by allowing processes to access
Programming abstractions for AS
17/51
◮ manage knowledge repositories by ◮ withdrawing information - get(T)@c, ◮ retrieving information - qry(T)@c ◮ adding information - put(t)@c ◮ create new names or new components I[K, Π, P] -
Programming abstractions for AS
18/51
◮ Model resource allocation and distribution ◮ Reflect the idea of administrative domains, i.e. the authority
◮ are modelled by resorting to the notions of system,
◮ Single component C ◮ Parallel composition
Programming abstractions for AS
19/51
◮ An interface I containing information about the component
◮ id: the name of the component C ◮ A knowledge manager K providing control data (i.e. the local
◮ A set of policies Π regulating inter-component and
◮ A process term P that performs the local computation,
Programming abstractions for AS
20/51
◮ Interaction policies: interaction predicates, for modeling
◮ Authorization policies: accounting, leasing, trust, reputation
◮ Policies for access control, resource usage, adaptation, . . .
◮ simple and unambiguous syntax (declarative style) ◮ industry basis (OASIS standard XACML) ◮ formal semantics ◮ Java implementation (http://rap.dsi.unifi.it/facpl/)
Programming abstractions for AS
21/51
◮ Components:
Knowledge
Processes
Interface
Policies
◮ Systems:
Knowledge
K
Processes
P
I
Interface
Π
Policies Knowledge
K
Processes
P
I
Interface
Π
Policies
Knowledge
K
Processes
P
I
Interface
Π
Policies
Programming abstractions for AS
22/51
Knowledge
Processes
Interface
Policies Normal flow Reasoner Integrator
Reasoner
Reasoning request
Programming abstractions for AS
23/51
Programming abstractions for AS
24/51
Programming abstractions for AS
25/51
◮ SCEL syntax does not have specific syntactic constructs for
◮ Components Interfaces specify (possibly dynamic) attributes
◮ Predicate-based communication tests attributes to select the
Programming abstractions for AS
26/51
◮ Ensembles are determined by the predicates validated by each
◮ There is no coordinator, hence no bottleneck or critical point
◮ A component might be part of more than one ensemble
Programming abstractions for AS
27/51
◮ id ∈ {n, m, p} ◮ active = yes ∧ battery level > 30% ◮ rangemax >
◮ true ◮ trust level > medium ◮ . . . ◮ trousers = red ◮ shirt = green
Programming abstractions for AS
28/51
◮ Adding a specific syntactic category for ensembles that would
◮ Enriching interfaces of components with special attributes,
Programming abstractions for AS
29/51
Programming abstractions for AS
30/51
◮ The structure of the aggregated components is static, defined
◮ a component can be part of just one ensemble.
Programming abstractions for AS
31/51
◮ ensemble: a predicate on interfaces used to determine the
◮ membership: a predicate on the interfaces used to determine
Programming abstractions for AS
32/51
Programming abstractions for AS
33/51
Programming abstractions for AS
33/51
◮ A set of states S ◮ A set of transition labels L ◮ A labelled transition relation −
Operational semantics for SCEL
34/51
Operational semantics for SCEL
35/51
◮ a.P executes action a and then behaves like process P ◮ ↓◦ indicates that process P may always decide to stay idle ◮ The semantics of P[ Q ] at process level is very permissive and
Operational semantics for SCEL
36/51
λ
Operational semantics for SCEL
37/51
λ
Operational semantics for SCEL
37/51
I:t⊳n
τ
◮ reads (and removes) from its knowledge repository ◮ after checking that tuple t is present and removes it ◮ asks the authorization to perform the action
Operational semantics for SCEL
38/51
I:t⊳n
1
I:t ¯ ⊳ J
2
τ
1[I.π := Π′] S′ 2
◮ reads tuple t from the knowledge repository of J .id = n ◮ after checking that component n is willing to provide it ◮ and after checking that it has the appropriate authorizations
Operational semantics for SCEL
39/51
I:t⊳P
1
I:t ¯ ⊳ J
2
τ
1[I.π := Π′] S′ 2
◮ reads tuple t from the knowledge repository of a component
◮ after checking that component n is willing to provide it ◮ and after checking that it has the appropriate authorisations
Operational semantics for SCEL
40/51
◮ have limited battery lifetime ◮ can discover target locations ◮ can inform other robots
A robotics scenario
41/51
WORKERS LANDMARKS VICTIM robot perception range
◮ Two kind of robots (landmarks
◮ No obstacles (except room
◮ Landmarks randomly walk until
◮ Workers initially motionless;
A robotics scenario
42/51
2 1 1 2 3 3
A robotics scenario
43/51
◮ We obtain a sort of
◮ When workers reach a landmark
A robotics scenario
44/51
VictimSeeker = qry(“victimPerceived”, true)@self . put(“stop”)@self . put(“victim”, self , 0)@self DataForwarder = qry(“victim”, ?id, ?d)@(role = “landmark”). put(“stop”)@self . put(“victim”, self , d + 1)@self RandomWalk = put(“direction”, 2πrand())@self . qry(“collision”, true)@self . RandomWalk
GoToVictim = qry(“victim”, ?id, ?d)@(role = “landmark”). put(”start”)@self . put(“direction”, towards(id))@self . while(d > 0){ d := d − 1. qry(“victim”, ?id, d)@(role = “landmark”). put(“direction”, towards(id))@self } qry(“victimPerceived”, true)@self . put(“stop”)@self
A robotics scenario
45/51
VictimSeeker = qry(“victimPerceived”, true)@self . put(“stop”)@self . put(“victim”, self , 0)@self DataForwarder = qry(“victim”, ?id, ?d)@(role = “landmark”). put(“stop”)@self . put(“victim”, self , d + 1)@self RandomWalk = put(“direction”, 2πrand())@self . qry(“collision”, true)@self . RandomWalk
GoToVictim = qry(“victim”, ?id, ?d)@(role = “landmark”). put(”start”)@self . put(“direction”, towards(id))@self . while(d > 0){ d := d − 1. qry(“victim”, ?id, d)@(role = “landmark”). put(“direction”, towards(id))@self } qry(“victimPerceived”, true)@self . put(“stop”)@self
A robotics scenario
45/51
VictimSeeker = qry(“victimPerceived”, true)@self . put(“stop”)@self . put(“victim”, self , 0)@self public class VictimSeeker extends Agent { private int robotId; protected void doRun() throws IOException, InterruptedException{ query(new Template(new ActualTemplateField(”VICTIM PERCEIVED”), new ActualTemplateField(true)) , Self.SELF); put( new Tuple( ”stop” ) , Self.SELF); put( new Tuple( ”victim” , robotId , 0 ) , Self.SELF); } } }
A robotics scenario
46/51
A robotics scenario
47/51
1000 2000 3000 4000 5000
0.2 0.4 0.6 0.8 1
10 Landmarks 20 Landmarks 50 Landmarks 100 Landmarks
A robotics scenario
48/51
◮ working on interaction policies to study the possibility of
◮ considering different knowledge repositories and ways of
◮ assessing the impact and the sensitivity of different adaptation
◮ developping quantitative variants of SCEL to support
◮ distilling a core calculus with attribute based communication
Ongoing & future work
49/51
A formal approach to autonomic systems programming: The SCEL Language. R. De Nicola, M. Loreti, R. Pugliese, F. Tiezzi. ACM TAAS 9(2). ACM Press, 2014 ◮ On Programming and Policing Autonomic Computing Systems. M. Loreti, A. Margheri, R. Pugliese, F. Tiezzi. In Proc. ISOLA, LNCS. Springer, 2014 ◮ Self-expression and Dynamic Attribute-based Ensembles in SCEL. G. Cabri, N. Capodieci, L. Cesari, R. De Nicola, R. Pugliese, F. Tiezzi, F. Zambonelli. In
◮ Programming and Verifying Component Ensembles. R. De Nicola, A. Lluch Lafuente, M. Loreti, A. Morichetta, R. Pugliese, V. Senni, F. Tiezzi. In Proc. FPS, LNCS 8415, 69–83. Springer, 2014 ◮ Formalising Adaptation Patterns for Autonomic Ensembles. L. Cesari, R. De Nicola, R. Pugliese, M. Puviani, F. Tiezzi, F. Zambonelli. In Proc. of FACS, LNCS 8348, 100-118. Springer, 2014 ◮ Reasoning on Service Component Ensembles in Rewriting Logic. L. Belzner, R. De Nicola, A. Vandin, M. Wirsing. In Proc. of SAS, LNCS 8373, 188–211. Springer, 2014 ◮ Stochastically timed predicate-based communication primitives for autonomic
1-16. EPTCS, 2014
Ongoing & future work
50/51
Ongoing & future work
51/51