A Domain-Specific Language For The Control of Self-Adaptive Component-Based Architecture
A Domain-Specific Language For The Control of Self-Adaptive Component-Based Architecture
a r t i c l e i n f o a b s t r a c t
Article history: Self-adaptive behaviours in the context of Component-based Architecture are generally designed based on
Received 16 February 2016 past monitoring events, configurations (component assemblies) as well as behavioural programs defining
Revised 13 January 2017
the adaptation logics and invariant properties. Providing assurances on the navigation through the config-
Accepted 31 January 2017
uration space remains a challenge. That requires taking decisions on predictions on the possible futures
Available online 1 February 2017
of the system in order to avoid going into branches of the behavioural program leading to bad configura-
MSC: tions. We propose the design of self-adaptive software components based on logical discrete control ap-
10.040 proaches, in which the self-adaptive behavioural models enrich component controllers with a knowledge
10.280 not only on events, configurations and past history, but also with possible future configurations. This arti-
10.090 cle provides the description, implementation and discussion of Ctrl-F, a Domain-specific Language whose
10.050
objective is to provide high-level support for describing these control policies. Ctrl-Fis formally defined
20.120
by translation to Finite State Automata models, which allow for the exploration of behavioural programs
Keywords: by verification or Discrete Controller Synthesis, i.e., by automatically generating a controller to enforce
Component-based architecture correct self-adaptive behaviours. We integrate Ctrl-F with FraSCAti, a Service Component Architecture
Self-adaptation middleware platform and we illustrate the use of Ctrl-Fby applying it to two case studies.
Discrete control
© 2017 Elsevier Inc. All rights reserved.
http://dx.doi.org/10.1016/j.jss.2017.01.030
0164-1212/© 2017 Elsevier Inc. All rights reserved.
F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112 95
architectures (e.g., web applications with hundreds/thousands of have to be kept invariant regardless of the configuration at run-
replicated components with specific tuning parameters and con- time.
straints), to conceive well-mastered self-adaptive behaviours, with Ctrl-F programs are modelled in Heptagon/BZR (cf. Fig. 1(b))
assurances on the way the navigation through the configuration with a set of data-flow equations, automata and contracts, which is
space is performed. Our previous work (Alvares et al., 2015b) tack- used to specify the controllable variables and the control objectives
les this problem by proposing Ctrl-F, a DSL that extends classic used for DCS. The result of the compilation of a given behavioural
ADLs with high-level constructs to describe adaptation in software program is an executable function, i.e.,a controller (cf. Fig. 1(c), DCS
components by means of behavioural programs, i.e., in terms of Ctrlr) which, at each decision step, takes the current state and cur-
order and/or conditions under which reconfigurations take place; rent events (u in Fig. 1(c), referring to uncontrollable variables),
and policies, i.e., constraints that have to be enforced all along and returns a control value (c in Fig. 1(c)) corresponding to the
the execution. In other words, Ctrl-Fis a first-class language that next configuration such that the stated policies are respected.
is applicable to any Component-based application requiring self- Since the combinatorial complexity of the formal exploration
adaptation with formal guarantees. performed by DCS can be exponential in the number of configu-
Adaptation decisions are taken at runtime by choosing the next rations and hence very costly to be performed at runtime, we ad-
configuration in function of not only the observed past history vocate that the DCS should rather be performed off-line. That is
(monitoring events, states, configurations), but also on behavioural to say that controllers are compiled away so as to provide correct
programs describing the adaptation logics and properties to be solutions at runtime. It is obvious that it comes at the cost of re-
kept invariant all over the managed system’s execution (Garlan quiring a previous knowledge on all possible configurations of the
et al., 2004b; Kouchnarenko and Weber, 2014). That form of de- system, which is the case of the behavioural programs of Ctrl-F. On
cision must involve not only updating the current advancement in the other hand, having controllers generated at design-time makes
the behaviours, but also some predictions on the possible futures decision-making more reactive at runtime, because the solutions
of the system. These guarantees can be achieved with the support are already computed. In addition, decisions made by controllers
of control theoretical approaches (Brun et al., 2009), where the may be way more complex than just selecting configurations. It
use of behavioural models allows for predictive decisions. Control- may involve also incoming events, past and future configurations,
based approaches for software systems have been investigated, which makes it difficult to achieve without the proper formal sup-
mainly concerning quantitative aspects and using continuous con- port, and even more so if guarantees have to be provided. Fur-
trol (Abdelzaher et al., 2008). The use of discrete control is how- thermore, DCS is done in a maximal permissive way, meaning that
ever more appropriated in the context of this work, since the pur- besides ensuring the correctness of decisions, the generated con-
pose here is to choose configurations in a logical-basis. In partic- troller makes it optimal, in the sense that it keeps the maximum of
ular, we address the design of such a decision-maker as a Discrete possible configurations not violating the stated policies, and hence
Controller Synthesis (DCS) problem (Marchand et al., 20 0 0), which making the controlled system maximally flexible.
consists in automatically generating a controller capable of control- With respect to our previous contributions (Alvares et al.,
ling a set of input variables such that a given temporal property is 2015a; 2015b), this article provides a more complete and detailed
satisfied. description of the Ctrl-Flanguage, on the whole translation pro-
For that purpose, our previous work formally define the seman- cess into Heptagon/BZR, as well as on its implementation and in-
tics of Ctrl-Fbehavioural programs by the translation to Finite State tegration with FraSCAti (Seinturier et al., 2012), a middleware al-
Automata (FSA) behavioural models (Alvares et al., 2015a), which lowing for runtime reconfiguration of Service Component Archi-
provide knowledge on events, states, past history as well as on tecture (SCA) software systems. Besides the news web application
possible futures, i.e., the space of reachable configurations. Hence, case study Znn.com (Cheng et al., 2009), which is used to illustrate
we are be able to, by control, avoid going into behavioural pro- the main concepts of Ctrl-Fand their compilation towards Hep-
gram branches leading to wrong configurations. More precisely, we tagon/BZR, this article also illustrates the use of Ctrl-Fto a work-
provide full translation from Ctrl-Fto the reactive language Hep- flow application with mutual exclusion requirements, which allows
tagon/BZR (Delaval et al., 2010), which allows the compilation to- for more elaborated discussions on certain features that cannot be
wards formal tools and thereby benefit from state space explo- deeply explored by Znn.com, such as making decisions considering
ration by both DCS and verification. the possible future configurations.
The principle is to have a feedback control loop within each The remainder of this article is organized as follows.
component (cf. Fig. 1(a)), which takes decisions in response to Section 2 introduces the main concepts necessary to understand
occurred events, while taking into consideration the current/past our approach. Section 3 presents the Ctrl-Flanguage in details,
configurations, a behavioural program, and determining as result while its compilation to Heptagon/BZRis detailed in Section 4.
which configurations (i.e.,how architectural elements are put to- Section 5 provides some details on the Ctrl-Fcompilation tool-
gether) have to be terminated and which ones have to be started. chain and integration with a FraSCAti middleware platform.
We rely on Ctrl-Fto specify: (i) behaviours in a in terms of se- Section 6 presents two case studies that foster a detailed discus-
quences, alternative/conditional/parallel branches and loops of con- sion on the applicability, usefulness and limitations of our ap-
figurations; and (ii) policies, which take the form of properties that proach. Related work is discussed in Section 7 and Section 8 con-
96 F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112
cludes this article while pointing out some perspectives for future
work.
2. Background
the with block (line 5) defines two controllable variables that are
used within the node (lines 7 and 8). In practice, they will be given
values such that variables a1 and a2 are never both true at the
same instant.
3. Ctrl-F language
Fig. 4. Language abstract syntax. Listing 4. Architectural description of component Znn in Ctrl-F.
3.3. Behaviours
Table 2
Summary of behaviour statements.
Statement Description
B when e1 do B1 ,
... , Execute B until an occurrence of ei then reconfigure to execute Bi
en do Bn end
case c1 then B1 ,
... , Execute Bi if ci holds, otherwise execute Be
cn then Bn
else Be end
B1 ||B2 Execute B1 and B2 in parallel
B1 |B2 Execute either B1 or B2
do B every e Execute B and re-execute it at every occurrence of e
3.3.1. Statements
Table 2 summarizes the behaviour statements of the Ctrl-
Fbehavioural language. During the execution of a given behaviour alternative one. It is important to mention that the decision on one
B, the when-do statement states that when an event of type ei oc- or other configuration must be taken at runtime according to in-
curs the configuration(s) that compose(s) B should be terminated put variables (e.g., income events) and the stated policies, that is,
and that (those) of the corresponding behaviour Bi is (are) started. there must be a control mechanism for reconfigurations that en-
The case-then statement is quite similar to when-do. The differ- forces those policies. We come back to this subject in Section 4.
ence resides mainly in the fact that a given behaviour Bi is ex- Regarding component Znn, the expected behaviour is to start
ecuted if the corresponding condition ci holds (e.g., conditions on with the minimum number of AppServer instances (configuration
attribute values), which means that it does not wait for an event to conf1) and add one more instance, i.e., leading to configuration
occur. In addition, if none of the conditions holds (c1 ∧ . . . ∧ cn = 0), conf2, upon an event of type (oload). From conf2, one more in-
a default behaviour (Be ) is executed, which forces the compiler to stance must be added, upon an event of type oload leading to con-
choose at least one behaviour. The parallel statement (with opera- figuration conf3. Alternatively, upon an event of type uload, one
tor ||) states that two behaviours are executed at the same time, instance of AppServer must be removed, which will lead the ap-
i.e., at a certain point, there must be two independent branches of plication back to configuration conf1. Similarly, from configuration
behaviour executing in parallel. This construct is also useful in the conf3, upon a uload event, an instance of AppServer is removed,
context of atomic components like AppServer, where we can, for leading the application to conf2. It is notorious that this behaviour
instance, define configurations composed of orthogonal attributes can be easily expressed by an automaton, with three states (one
like fidelity and font size/color (e.g., text || font-huge). per configuration) and four transitions (triggered on the occurrence
The alternative statement (with operator |) allows to describe of oload and uload). However, Ctrl-Fis designed to tackle the adap-
choice points among configurations or among more elaborated se- tation control problem in a higher level, i.e., with statements over
quential behaviour statements. They are left free in local specifica- configurations.
tions and will be resolved in upper level assemblies, in such a way For these reasons, we describe the behaviour with two embed-
as to satisfy the stated policies, by controlling these choice points ded do-every statements, which in turn comprise each a when-do
appropriately. Finally, the do-every statement allows for execution statement, as shown in Listing 8 (lines 6–14 and 8–12). We also de-
of a behaviour B and re-execution of it at every occurrence of an fine two auxiliary configurations: emt1 (line 2) and emt2 (line 3),
event of type e. It is noteworthy that behaviour B is preempted which extend respectively configurations conf2 and conf3, with an
every time an event of type e occurs. In other words, the configu- instance of a pre-defined component Emitter. This component does
ration(s) currently activated in B is (are) terminated, and the very nothing but emits a given event (e.g., e1 and e2) so as to force a
first one(s) in B is (are) started. loop step and thus go back to the beginning of the when-do state-
ments. The main do-every statement (lines 6–14) performs a when-
3.3.2. Example in Znn.com do statement (lines 7–13) at every occurrence of an event of type
We now illustrate the use of the statements we have introduced e1. In practice, the firing of this event allows going back to conf1
to express adaptation behaviours for components AppServer and regardless of the current configuration being executed. conf1 is ex-
Znn of the Znn.comcase study. The expected behaviour for com- ecuted until the occurrence of an event of type oload (line 7), then
ponent AppServer is to pick one of its three configurations (text, the innermost do-every statement is executed (lines 8–12), which
img-ld or img-hd) at every occurrence of events of type oload or in turn, just like the other one, executes another when-do state-
uload. As can be seen in Listing 7, the behaviour can be decom- ment (lines 9–11) and repeats it at every occurrence of an event of
posed in a do-every statement, which is, in turn, composed of an type e2. Again, this structure allows the application to go back to
F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112 101
3.4.1. Constraints/optimization on attributes The component is the core of the Ctrl-Fdescription and can be
This kind of constraints are predicates and/or primitives of opti- modeled as an Heptagon/BZRnode, as shown in Fig. 8. The node
mization objectives (i.e., maximize or minimize) on component at- takes as input external request (r) and end notification (e) sig-
tributes. Listing 9 illustrates some constraints and optimization on nals, and a set of events {v1 , . . . , vk }, which corresponds to the
component attributes. The first two policies state that the overall event types the component in question (comp) listens to. As out-
fidelity for component instance soccer should be greater or equal put, it produces a set of request (resp. end) signals {r1 , . . . , rm }
to 0.75, whereas that of instance politics should be maximized. (resp. {e1 , . . . , em }) for each configuration confi , for i ∈ [1, m], de-
Putting it differently, instance soccer must never have its content fined within the concerned component. In addition, it also returns
fidelity degraded, which means that it will have always priority a set of weights {w1 , . . . , wl }, for the attribute valuation for each at-
over politics. The third policy states that the overall consumption tribute in the component. The main node (comp in Fig. 8) may con-
should not exceed 5, which can be interpreted as a constraint on tain a contract in which a set of controllable variables {c1 , . . . , cq }
the physical resource capacity, e.g., the number of available ma- (in the case there is any choice point such as a behaviour with an
chines or processing units. alternative statement) and the reference to the set of stated poli-
cies ({p1 , . . . , pt }) in order for them to be enforced by the controller
3.4.2. Temporal constraints resulting from the DCS. The details on how policies are translated
Temporal constraints refer to logical time and take the form of are given in Section 4.3.
predicates on the order of configurations. These constructs might Component behaviours are modeled as a sub-node (bcomp in
be very helpful when there are many possible reconfiguration Fig. 8), which consists of an automaton describing the order and
paths (by either parallel or alternative composition, for instance), in conditions under which configurations take place. For this purpose,
which case the manual specification of such constrained behaviour it gets as input the same request (r), end (e) and event ({v1 , . . . , vk })
102 F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112
4.2. Behaviours
6. Case studies
that is, it releases one instance of AppServer (as3). The same hap-
pens with soccer at step 10, which makes room on the resources
and therefore allows politics to bring back the fidelity level of its
as2 to img-ld. Note that it cannot go directly to from text to img-
hd, even if there are enough resources for that. This is repeated at
steps 13 and 14 for instances politics and soccer respectively, bring-
ing their consumptions at the same levels as in the beginning.
When the current situation is that task Tij , the jth in branch i, is
active, then upon reception of event eij , the reaction is to go to the
next task in sequence in the flow (there can possibly be several
tasks to start if there is a parallel branch). This is done by a re-
configuration from the current global configuration, towards a new
configuration where the sub-assembly corresponding to the termi-
nated task is replaced by the sub-assembly corresponding to the
new ones.
Table 4 Table 6
Workflow Evolution Under Scenario 1. Workflow Evolution Under Scenario 3.
Table 5 Tables 4–6 show how the system evolves in terms of reconfig-
Workflow Evolution Under Scenario 2.
uration in response to a sequence of input events. The first row
shows the incoming events at each logical time ti . The second to
the thirteenth rows indicate whether each configuration is active,
whereas the fourteenth row shows the sum of both attributes r1
and r2.
For the first scenario (cf. Table 4), the sequence e0 , e11−12 and
e12−13 leads the system to the choice point a (at step t4 ) before
the choice point b, which makes the controller pick the alternative
that contains the configuration T13a1 since it minimizes the sum
of attributes r1 and r2. Upon event e21−22 , the system is led to
the choice point b (at step t5 ) and the controller is forced to pick
the alternative containing configuration T22a so as to respect the
exclusion with T13a2 and thus avoid an eventual policy violation
(r1 + r2 > 1.0).
Conversely, the sequence e0 and e21−22 /e11−12 (cf. Table 5) takes
the system first to the choice point b (at step t3 ), which makes
the controller choose the alternative containing T22b1, since it
minimizes the resource consumption at next step. The next event
(e12−13 ), at step t3 , lead the other branch to choice point a (at step
t4 ). Since, at that point in time, configuration T22b2 has not yet
passed, the controller is forced to pick T13b in order to respect the
mutual exclusion.
choice point a is evaluated before choice point b; (ii) when the Finally, for the third scenario (cf. Table 6), upon events e0 ,
choice point b is evaluated before choice point a; and when both e11−12 , e12−13 / e21−22 , the system is lead to both choice points
choice points are evaluated at the same time. We consider the val- a and b at the same time, i.e., at step t3 . At that point, the de-
ues for attributes r1 and r2 for each configuration as shown in cision taken by the controller is performed at the same time for
Table 3. both choice points so that the mutual exclusion is respected and
F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112 109
the sum of resources is minimized. Thus, based on those criteria, extremely reactive in the sense that they take decisions almost in-
for one branch, the configuration T13b is picked, whereas the al- stantaneously.
ternative containing configuration T22a1a is chosen for the other We also have some perspectives to mitigate those shortcomings
branch. (cf. Section 8). First, it may be possible to perform modular DCS,
Although the scenarios above illustrate situations where either which consists in decomposing the DCS problems within Ctrl-Fand
T13a2 or T22b2 Â are executed at the same time, there might be Heptagon/BZRinto smaller ones so as to break down the combina-
scenarios where the alternative statement of one branch is exe- torial complexity. Moreover, we might as well consider DCS in the
cuted entirely before the one of the other branch. This means that context of self-adaptive controllers, that is, controllers that can be
the controller may allow the execution of both T13a2 and T22b2 updated in case the system model (e.g.,the possible configurations)
as soon as the alternative behaviours are not executed at the same changes at runtime, while still providing formal guarantees.
time.
6.3.3. Input events and attribute values
6.3. Discussion and threats to validity In both case studies, the input events are intended to simu-
late critical situations and assess how the controller can manage
6.3.1. Comparison with other approaches them. For instance, this the case when a competition for resources
In spite of the fact that Znn.com is widely known in the self- between the two instances of Znn is simulated in order to ob-
adaptive systems’ community, it cannot yet be considered as a serve how the policy constraining some sequences of configura-
benchmark. Also, most of the approaches that use Znn.com as case tions text, img-ld and img-hd is enforced; or when parallel tasks
study focus more on the numerical aspects of adaptation (e.g., consume resources that are mutually exclusive in order to assess
number of replicas kept under a certain threshold while maxi- if the branches are chosen (in advance) accordingly. Changing the
mizing fidelity), but do not provide support for the combinato- order in which events occur would not affect the managed sys-
rial exploration/management and guarantees, going until the pre- tem itself, but would certainly affect our perception on these nu-
dictive aspects, that are key-features of Ctrl-F. On the other hand, ances that are important for understanding possible systems’ mis-
Ctrl-Fdoes not support continuous/numerical control. Therefore, it behaviours when they are not controlled. Lastly, the values to be
is very hard to quantitatively compare discrete/logical approaches assigned to the attributes were also chosen in order to promote
with continuous/numerical ones. In this context, the case studies the need for adaptation, due to either mutual exclusion and/or
discussed in this section are useful to evaluate qualitative rather scarcity of resources. For example, much greater consumption val-
than quantitative aspects like what the proposed language is in- ues in Znn.com components might make the DCS fail in finding a
tended to describe and what the generated controllers are capable solution, whereas much lower consumptions would find too per-
of guaranteeing. missive solutions, making AppServer component instances to stay
From the language perspective, both case studies show how indefinitely in configuration img-hd, dismissing eventually the need
Ctrl-Fcan help to define, in high-level and descriptive manner, for control.
any kind of component-based software system requiring self-
adaptation. Indeed, they enable the illustration of a range of Ctrl- 7. Related work
Fconstructs like loop (do-every), alternative (|), parallel (||) and
sequence (when-do). From the control-theoretical point of view, Self-adaptation has been given much attention over the past
the adaptation scenarios presented as part of the case studies years and has been associated to many different research fields.
show in a pedagogical way, how controllers obtained from Ctrl- The research roadmap resulting from the 2010’s edition of the
Fcompilation to Heptagon/BZRand DCS are capable of controlling Dagstuhl Seminar on Software Engineering for Self-Adaptive Sys-
reconfigurations by involving an exploration of future branches, tems (de Lemos et al., 2013) points characterisation of the design
from the current global advancement state, taking into account all space, decentralization of feedback loops and validation and veri-
possible event interleavings, and possible control choices in order fication among the major challenges to be faced by self-adaptive
to guarantee the stated policies. software systems. Brun et al. (2009) pointed out the importance
of understanding the notions of feedback loops that can be found
6.3.2. Scalability and on-the-fly DCS in different areas (e.g., control theory and bio-inspired systems) to
As previously stated, the formal exploration performed by the engineer self-adaptive systems. Kramer and Magee (2007) high-
DCS is rather at design-time than at runtime, as its complexity lights the pertinence of building self-adaptive software systems
can be exponential in the number of configurations. That also re- at the architectural level and took inspiration from robotics (Gat,
quires a previous knowledge on all possible configurations of the 1998) to propose a three layer reference model (component con-
system, since it performs computation over an exact previously trol, change and goal management) for self-managed systems. All
known state space, which is used to control the dynamics of the these seminal work have, to a certain extent, inspired the way we
system at runtime as a means to provide guarantees. Note that this designed Ctrl-Fand structured its underlying runtime tooling.
level of guarantee is not achieved by more dynamic approaches, In the domain of Component-based Software Development,
i.e.,by approaches where the decision-making is performed on-the- runtime adaption is classically achieved by first relying on ADLs
fly. It should be reminded that in our approach, adaptation deci- such as Acme (Garlan et al., 20 0 0) or Fractal (Bruneton et al., 2004)
sions are taken based upon observation of the current state and for an initial description of the software structure and architecture,
past events, but also prediction of possible futures from the cur- then by specifying fine-grained reconfiguration actions with dedi-
rent state. The manual design and writing of a control program cated languages like Plastik (Batista et al., 2005) or FPath/FScript
doing this correctly would be very tedious and error-prone. Espe- (David et al., 2008), or simply by defining Event-Condition-Actions
cially, obtaining a correct controller (which would require verifica- (ECA) rules to lead the system to the desired state. In Luckey et al.
tion by model-checking anyway) is not the only goal: it is impor- (2011), the authors propose AdaptCases, a domain-specific mod-
tant to have a maximally permissive controller, in order to keep eling language that relies on UML to formally specify adaptivity,
the maximum flexibility in the execution and be minimally con- in which adaptations are also modeled in an ECA/threshold based
straining by forbidding alternative branches only when necessary. fashion.
Furthermore, since DCS is performed off-line and the solutions are A harmful consequence is that the space of reachable config-
already computed and compiled away, the resulting controllers are uration states is only known as side effect of those reconfigura-
110 F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112
tion actions, which makes it difficult to ensure correct adaptive In Calinescu et al. (2012), the authors advocate the employment
behaviours. Moreover, a drawback of ECA rules is that, contrary to of runtime quantitative verification to formally analyse correctness,
Ctrl-F, they cannot describe sequences of configurations. Even so, reliability and performance of systems exhibiting stochastic be-
ECA rules can be expressed in Ctrl-F with a set of when-do (for the haviours, in which probabilities and temporal properties guide the
E part) and case (for the C and A parts) statements in parallel. navigation through states (configurations). An innovating aspect of
FORMS (FOrmal Reference Model for Self-adaptation) (Weyns the approach is that the overhead incurred by verification at run-
et al., 2012) is a unified model for specifying distributed self- time can be mitigated by pre-computing probabilities as symbolic
adaptive systems. The model is the result of the combination of expressions (Filieri et al., 2011), which is, to a certain extent, sim-
three concerns: computation reflection, to facilitate the separation ilar to what is done in the DCS technique. However, our approach
between environment, managed subsystems and adaptation rea- differs in some aspects: first, our model is deterministic and we
soning subsystem; distribution, which eases the specification of focus on the possible future configurations to avoid potential bad
coordination mechanisms among different distributed self-adaptive branches of the adaptive program; further, we also provide an end-
elements; and MAPE-K, to formally define the control loop logics. to-end solution, from a high-level DSL to the actual manager that
While FORMS is intended to serve as a (generic) reference model enacts self-adaptive behaviours in the target system.
to specify self-adaptive systems of any domain, our approach dif- Kouchnarenko and Weber (2014) propose the use of tempo-
fers focus on a specific domain (i.e.,component-based architecture). ral logics to integrate temporal requirements to adaptation poli-
Besides, we provide transformation mechanisms allowing for the cies in the context of Fractal components (Bruneton et al., 2004).
automatic generation of correct-by-construction managers out of a The policies specify reflection or enforcement mechanisms, which
high-level domain-specific model. refer respectively to corrective reconfigurations triggered by un-
Rainbow (Garlan et al., 2004b) provides an autonomic frame- wanted behaviours, and avoidance of reconfigurations leading to
work for Acme components (Garlan et al., 20 0 0). A DSL called unwanted states. While in those approaches, enforcement (resp.
Stitch is used to express autonomic behaviours (called strategies) decisions over strategies’ branches) and reflection are performed at
in a tree-like manner. Branches in strategies are selected online runtime, in our approach, the decision-making is obtained in an off-
by a utility-based algorithm according to runtime conditions. At line manner, through the reactive language Heptagon/BZR and by
the end (when it gets to a leaf in the tree), a strategy is eval- performing DCS. This way, the exploration of behavioural programs
uated as successful or failed and this information is used to im- is compiled away, producing as result a maximal permissive and
prove the selection algorithm. From the language perspective, our correct-by-construction controller that enforces correct autonomic
language provides an interesting set of behavioural statements in- behaviours. That can be seen as a tremendous advantage, since
cluding alternative and parallel, as well as the event-based ones the formal exploration can be very costly and exponential in the
like every and when-do. That makes Ctrl-Fmore expressive in terms number of possible configurations to be performed online, which
of behavioural definition. Furthermore, thanks to the Ctrl-F’s for- is even more complex when the control is required to be least re-
mal model in the reactive language Heptagon/BZR, it is possible strictive. Conversely, due to model incompleteness and uncertain-
to ensure correct adaptation behaviours either by verification or ties inherent to unpredictable environments, assumptions taken at
control, that is, by the generation of correct-by-construction con- design time may no longer hold at runtime.
trollers that enforce such behaviours. One way to mitigate this limitation is to have a multi-tier con-
A body of work (Arshad and Heimbigner, 2005) on how to trol, as proposed by D’Ippolito et al. (2014). The idea is that one
plan a set of actions that safely lead component-based systems can define multiple models and controllers associated to differ-
to a target configuration. In Boyer et al. (2013), the authors pro- ent levels of assumptions (from the least to the most restrictive)
pose a robust reconfiguration protocol establishing proper orders and guaranteeable functionalities. The level of control is then de-
of reconfiguration operations (start, stop, wire, etc.) based on a termined according to the validity of assumptions at runtime. The
contract that has to be fulfilled (e.g.,architectural invariants). This same research group also proposes an approach for controller syn-
protocol is fully formalized and proved with Coq2 proof assistant. thesis of event-based systems (D’ippolito et al., 2013) and more
da Silva and de Lemos (2011) present a test-driven approach for recently a method to dynamically update synthesized controllers
self-adaptive component-based architecture, which consists in gen- (Nahabedian et al., 2016). These approaches perform the controller
erating reconfiguration plans incrementally and checking whether synthesis by generating executable automata out of temporal log-
the components added to a given configuration, at runtime, are ics formulae, i.e.,it does not contemplate the notion of controllable
able to communicate with the other components. In Tichy and and incontrollable. That kind of synthesis differs from the supervi-
Klöpper (2012), graph transformations are used to specify archi- sory control of discrete event-based systems that is used in our
tectural reconfigurations, which are then translated into the Plan- approach, in which from a model (e.g.,automate), from a set of
ning Domain Definition Language (PDDL) (Fox and Long, 2003). controllable and incontrollable input variables and an control ob-
While using PDDL makes it possible to use self-adaptation plan- jective (e.g.,invariance, reachability), a controller that restrains the
ning tools, graph transformations formalisms allow for verification system is synthesized. Still regarding controller synthesis, in Filieri
and code-generation to be executed at runtime. MechatronicUML et al. (2015); 2014). Filieri et al.propose a methodology to auto-
(Becker et al., 2014) also relies on UML and the underlying formal matically generate continuous controllers with formal guarantees
verification tools to prevent reconfigurations operations leading to from a set of high-level specifications, which differs from the DCS
unsafe configurations. In summary, those approaches focus on how used in our approach in that the former deals with numerical and
to plan a set of actions that safely lead systems to a target config- continuous variables, whereas in this work we focus on controlling
uration. Hence, they are complementary to ours in the sense that logically the models corresponding to the behaviour programmed
our focus is on the choice of a new configuration and its control within components.
as the behavioural program progresses. Once a new configuration In Morin et al. (2009) and Parra et al. (2009), feature models are
chosen, we rely on existing mechanisms to determine the plan of used to express variability in software systems. At runtime, a res-
actions actually leading the system from the current to the next olution mechanism is used for determining which features should
configuration. be present so as to constitute configuration. Those approaches rely
on Model-Driven Engineering to ease the mapping between fea-
tures and architectures as well as to automatically and dynami-
2
http://coq.inria.fr. cally generate the adaptation logics, i.e., the reconfiguration actions
F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112 111
leading the target system from the current to the target configura- branches, which, in the future, may lead the system to unsafe
tion. In the same direction, Pascual et al. (2013) propose an ap- states.
proach for optimal resolution of architectural variability specified
in the Common Variability Language (CVL) (Haugen et al., 2013). A 8.2. Contributions
major drawback of those approaches is that in the adaptation log-
ics specified with feature models or CVL, there is no way to define We tackled this problem by first proposing a high-level domain-
stateful adaptation behaviours, i.e., sequences of reconfigurations. specific language, named Ctrl-F, which allows for the description
In fact, the resolution is generally performed based on the current of adaptation behaviours and policies of component-based archi-
state and/or constraints on the feature model. On the contrary, in tectures and then by relying on discrete control to ensure correct
our approach, in the underlying reactive model based on FSA, de- adaptive behaviours. Concretely, we rely on Heptagon/BZR, a Finite
cisions are taken also based on the history and possible futures State Automata-based reactive language, to formally define Ctrl-F’s
of configurations which allows us to define more interesting and semantics. The compilation of Heptagon/BZRinvolves formal tools
complex behaviours, while providing guarantees on them. allowing for verification and Discrete Controller Synthesis (DCS),
As in our approach, in Bouhadiba et al. (2011), the authors which makes it possible to ensure correct adaptive behaviours of
also rely on Heptagon/BZR and DCS techniques to model auto- component-based software systems defined in Ctrl-F. While the
nomic behaviours in the context of Fractal components. An et al. DCS requires a previous knowledge of the system’ configurations
(2013) used Heptagon/BZR to achieve self-adaptation in the con- and may pose some combinatorial limitations, the synthesis is per-
text of partially reconfigurable FPGAs (Field Programmable Gate Ar- formed off-line, with no impact on the running system. Moreover,
rays). Although those approaches provide us with interesting in- that allows for more reactive (i.e.,quasi-instantaneous) decision-
sights on how adaptive behaviours can be formalized, there is no making as part of the adaptation process, while providing tool-
general method allowing for the direct translation from a high- support for managing the combinatorial configurations space, pre-
level description (e.g., ADL) to a synchronous reactive model. It dictive control with formal guarantees. To the best of our knowl-
means that for each new application, the formal model has to be edge, those features are not provided by current approaches in the
recreated. Moreover, reconfigurations are controlled at the level of state-of-the-art literature.
fine-grained reconfiguration actions (e.g., add/remove components This article extends our previous work (Alvares et al., 2015a;
and bindings), which can be considered time-consuming and dif- 2015b) by providing a detailed view on the Ctrl-Flanguage itself,
ficult to scale, especially for large-scale architectures. In compar- its compilation into Heptagon/BZRand its implementation and in-
ison, Ctrl-F proposes a set of high-level constructs to ease the tegration with FraSCAti, a Service Component Architecture middle-
description of adaptation behaviours and policies of component- ware platform. Besides, we applied Ctrl-Fto two cases studies and
based architectures. In addition, we propose an extensible Manager provided a rich discussion about its usefulness, applicability and
that bridges Ctrl-F and a real component platform. Delaval et al. limitations.
(2014) propose the use of components to embody autonomic man-
agers conceived with Heptagon/BZR. The idea is to have modular
8.3. Perspectives and future work
controllers that can be coordinated so as to work together in a co-
herent manner. The approach is complementary to ours: on the
The intrinsic combinatorial complexity of Discrete Controller
one hand, the approach does not provide means to describe be-
Synthesis raises some problems regarding the scalability of the ap-
havioural programs for those managers, although the authors pro- proach. One perspective to be explored to cope with this issue is
vide interesting intuitions on a methodology to do so. On the other
to decompose control problems specified in Ctrl-Fin a systematical
hand, our approach does not provide means for the specification
way, relying on the mechanisms of modular compilation and mod-
of the coordination among components’ controllers. We do believe ular DCS (Delaval et al., 2014). That may require some effort on
however that coordination is a major challenge that has to be tack-
both the language redefinition and the way it is translated to Hep-
led by any modular self-adaptive system. Hence, the integration
tagon/BZR. Another important aspect that should be investigated in
of coordination aspects to Ctrl-F and its behavioural formalization
this domain is the possibility to make the adaption policies them-
must be considered in future work. Moreover, modularity seems to
selves subject to change, in order to react to changes in operation
be an interesting perspective to mitigate the scalability issues due
conditions imposing other properties than the ones specified at de-
to state-space explorations.
sign time. In some contexts like in mobile computing, the presence
of components in the system can change, by appearing or disap-
pearing at any time. Therefore, an important perspective would be
8. Conclusion to work on a notion of adaptive control.
Reusability, modularity and reconfigurability are enabling prop- Abdelzaher, T., Diao, Y., Hellerstein, J., Lu, C., Zhu, X., 2008. Introduction to control
erties that make component-based architecture a major player in theory and its application to computing systems. In: Liu, Z., Xia, C. (Eds.), Per-
formance Modeling and Engineering. Springer US, pp. 185–215.
providing self-adaptive capabilities to software-intensive systems. Alvares, F., Rutten, E., Seinturier, L., 2015. Behavioural model-based control for au-
Architecture description languages enable to define initial configu- tonomic software components. In: Proc. 12th Int. Conf. Autonomic Computing
rations, on top of which reconfigurations actions can be programed (ICAC’15). Grenoble, France.
Alvares, F., Rutten, E., Seinturier, L., 2015. High-level language support for reconfig-
in order to adapt the concerned architecture to runtime condi-
uration control in component-based architectures. In: Proc. 9th European Conf.
tions. A negative consequence of following this approach is that on Software Architecture (ECSA). Dubrovnik, Croatia.
the space of reachable configurations is only known as a side-effect An, X., Rutten, E., Diguet, J.-P., Le Griguer, N., Gamatié, A., 2013. Autonomic manage-
ment of dynamically partially reconfigurable FPGA architectures using discrete
of those fine-grained actions, which makes it hard, especially in
control. In: In Proc. of the 10th International Conference on Autonomic Com-
large architectures or in complex adaptive behaviours, to ensure puting (ICAC’13). SAN JOSE, CA, United States.
correctness on the adaptive behaviours. In fact, such kind of adap- Arshad, N., Heimbigner, D., 2005. A Comparison of Planning Based Models for Com-
tive behaviours requires decisions that are taken based not only ponent Reconfiguration. Research Report CU-CS-995-05. U. Colorado.
Batista, T., Joolia, A., Coulson, G., 2005. Managing dynamic reconfiguration in com-
on the past/current configurations and incoming events, but also ponent-based systems. In: Proceedings of the 2Nd European Conference on Soft-
on possible (reachable) futures configurations in a way to avoid ware Architecture. Springer-Verlag, Berlin, Heidelberg, pp. 1–17.
112 F. Alvares et al. / The Journal of Systems and Software 130 (2017) 94–112
Becker, S., Dziwok, S., Gerking, C., Heinzemann, C., Schäfer, W., Meyer, M., Fox, M., Long, D., 2003. Pddl2.1: an extension to pddl for expressing temporal plan-
Pohlmann, U., 2014. The mechatronicuml method: Model-driven software en- ning domains. CoRR abs/1106.4561.
gineering of self-adaptive mechatronic systems. In: Companion Proceedings of Garlan, D., Cheng, S.-W., Huang, A.-C., Schmerl, B., Steenkiste, P., 2004A. Rainbow:
the 36th International Conference on Software Engineering. ACM, New York, NY, architecture-based self adaptation with reusable infrastructure. IEEE Comput. 37
USA, pp. 614–615. (10).
Berthier, N., Marchand, H., 2014. Discrete controller synthesis for infinite state sys- Garlan, D., Cheng, S.-W., Huang, A.-C., Schmerl, B., Steenkiste, P., 2004B. Rainbow:
tems with reax. In: IEEE International Workshop on Discrete Event Systems. architecture-based self-adaptation with reusable infrastructure. Computer 37
Cachan, France, pp. 46–53. (10), 46–54.
Bouhadiba, T., Sabah, Q., Delaval, G., Rutten, E., 2011. Synchronous control of re- Garlan, D., Monroe, R.T., Wile, D., 20 0 0. Acme: architectural description of compo-
configuration in fractal component-based systems: a case study. In: Proceedings nent-based systems. In: Leavens, G.T., Sitaraman, M. (Eds.), Foundations of Com-
of the Ninth ACM International Conference on Embedded Software. ACM, New ponent-Based Systems. Cambridge University Press, pp. 47–68.
York, NY, USA, pp. 309–318. Gat, E., 1998. Artificial Intelligence and Mobile Robots. MIT Press, Cambridge, MA,
Boyer, F., Gruber, O., Pous, D., 2013. Robust reconfigurations of component assem- USA, pp. 195–210. chapter Three-layer Architectures
blies. In: Proceedings of the 2013 International Conference on Software Engi- Halbwachs, N., 2010. Synchronous Programming of Reactive Systems. Springer-
neering. IEEE Press, Piscataway, NJ, USA, pp. 13–22. Verlag, Berlin, Heidelberg.
Brun, Y., Di Marzo Serugendo, G., Gacek, C., Giese, H., Kienle, H., Litoiu, M., Harel, D., 1987. Statecharts: a visual formalism for complex systems. Sci. Comput.
Müller, H., Pezzè, M., Shaw, M., 2009. Engineering Self-Adaptive Systems Program. 8 (3), 231–274. doi:10.1016/0167- 6423(87)90035- 9.
through Feedback Loops. Springer Berlin Heidelberg, Berlin, Heidelberg, Harel, D., Pnueli, A., 1985. Logics and Models of Concurrent Systems. Springer-Verlag
pp. 48–70. New York, Inc., New York, NY, USA, pp. 477–498. chapter On the Development
Bruneton, E., Coupaye, T., Leclercq, M., Quéma, V., Stefani, J.-B., 2004. An open of Reactive Systems
component model and its support in java. In: Proceedings of the International Haugen, O., Wasowski, A., Czarnecki, K., 2013. Cvl: common variability language. In:
Symposium on Component-based Software Engineering (CBSE’2003). Edinburgh, Proceedings of the 17th International Software Product Line Conference. ACM,
Scotland. New York, NY, USA. 277–277
Calinescu, R., Ghezzi, C., Kwiatkowska, M., Mirandola, R., 2012. Self-adaptive soft- Jacobson, I., Griss, M., Jonsson, P., 1997. Software reuse: Architecture process and
ware needs quantitative verification at runtime. Commun. ACM 55 (9), 69–77. organization for business success. ACM Press.
doi:10.1145/2330667.2330686. Kouchnarenko, O., Weber, J.-F., 2014. Adapting component-based systems at runtime
Cheng, S.-W., Garlan, D., Schmerl, B., 2009. Evaluating the effectiveness of the via policies with temporal patterns. In: Fiadeiro, J.L., Liu, Z., Xue, J. (Eds.), FACS
rainbow self-adaptive system. In: Software Engineering for Adaptive and Self– 2013, 10th Int. Symposium on Formal Aspects of Component Software, Revised
Managing Systems, 2009. SEAMS ’09. ICSE Workshop on, pp. 132–141. Selected Papers. Springer, Nanchang, China, pp. 234–253. Revised Selected Pa-
Colaço, J.-L., Pagano, B., Pouzet, M., 2005. A conservative extension of synchronous pers
data-flow with state machines. In: Proceedings of the 5th ACM International Kramer, J., Magee, J., 2007. Self-managed systems: an architectural challenge. In:
Conference on Embedded Software. ACM, New York, NY, USA, pp. 173–182. 2007 Future of Software Engineering. IEEE Computer Society, Washington, DC,
da Silva, C.E., de Lemos, R., 2011. Dynamic plans for integration testing of self- USA, pp. 259–268. doi:10.1109/FOSE.2007.19.
-adaptive software systems. In: Proc. 6th Int. Symp. on Software Engineering Luckey, M., Nagel, B., Gerth, C., Engels, G., 2011. Adapt cases: extending use cases
for Adaptive and Self-Managing Systems, pp. 148–157. for adaptive systems. In: Proceedings of the 6th International Symposium on
David, P.-C., Ledoux, T., Léger, M., Coupaye, T., 2008. FPAth & FScript: language sup- Software Engineering for Adaptive and Self-Managing Systems. ACM, New York,
port for navigation and reliable reconfiguration of fractal architectures. Ann. NY, USA, pp. 30–39. doi:10.1145/1988008.1988014.
Telecommun. 64 (1), 45–63. Marchand, H., Bournai, P., Le Borgne, M., Le Guernic, P., 20 0 0. Synthesis of dis-
Delaval, G., Gueye, S.M.-K., Rutten, E., De Palma, N., 2014. Modular coordination of crete-event controllers based on the signal environment. Discrete Event Dyn.
multiple autonomic managers. In: Proceedings of the 17th International ACM Syst. 10 (4), 325–346.
Sigsoft Symposium on Component-based Software Engineering. ACM, New York, Medvidovic, N., Taylor, R.N., 20 0 0. A classification and comparison framework for
NY, USA, pp. 3–12. software architecture description languages. IEEE Trans. Softw. Eng. 26 (1),
Delaval, G., Marchand, H., Rutten, E., 2010. Contracts for modular discrete controller 70–93.
synthesis. In: ACM International Conference on Languages, Compilers, and Tools Morin, B., Barais, O., Nain, G., Jezequel, J.-M., 2009. Taming dynamically adaptive
for Embedded Systems (LCTES 2010). Stockholm, Sweden. systems using models and aspects. In: Proceedings of the 31st International
de Lemos, R., Giese, H., Müller, H.A., Shaw, M., Andersson, J., Litoiu, M., Schmerl, B., Conference on Software Engineering. IEEE Computer Society, Washington, DC,
Tamura, G., Villegas, N.M., Vogel, T., Weyns, D., Baresi, L., Becker, B., Ben- USA, pp. 122–132.
como, N., Brun, Y., Cukic, B., Desmarais, R., Dustdar, S., Engels, G., Geihs, K., Nahabedian, L., Braberman, V., D’Ippolito, N., Honiden, S., Kramer, J., Tei, K., Uchi-
Göschka, K.M., Gorla, A., Grassi, V., Inverardi, P., Karsai, G., Kramer, J., Lopes, A., tel, S., 2016. Assured and correct dynamic update of controllers. In: Proceedings
Magee, J., Malek, S., Mankovskii, S., Mirandola, R., Mylopoulos, J., Nierstrasz, O., of the 11th International Symposium on Software Engineering for Adaptive and
Pezzè, M., Prehofer, C., Schäfer, W., Schlichting, R., Smith, D.B., Sousa, J.P., Tahvil- Self-Managing Systems. ACM, New York, NY, USA, pp. 96–107.
dari, L., Wong, K., Wuttke, J., 2013. Software Engineering for Self-Adaptive Sys- Parra, C., Blanc, X., Duchien, L., 2009. Context awareness for dynamic service-ori-
tems: A Second Research Roadmap. Springer Berlin Heidelberg, Berlin, Heidel- ented product lines. In: Proceedings of the 13th International Software Product
berg, pp. 1–32. doi:10.1007/978- 3- 642- 35813- 5_1. Line Conference. Carnegie Mellon University, Pittsburgh, PA, USA, pp. 131–140.
D’Ippolito, N., Braberman, V., Kramer, J., Magee, J., Sykes, D., Uchitel, S., 2014. Hope Pascual, G.G., Pinto, M., Fuentes, L., 2013. Run-time support to manage architectural
for the best, prepare for the worst: multi-tier control for adaptive systems. variability specified with cvl. In: Proceedings of the 7th European Conference
In: Proceedings of the 36th International Conference on Software Engineering. on Software Architecture. Springer-Verlag, Berlin, Heidelberg, pp. 282–298.
ACM, New York, NY, USA, pp. 688–699. Seinturier, L., Merle, P., Rouvoy, R., Romero, D., Schiavoni, V., Stefani, J.-B., 2012. A
D’ippolito, N., Braberman, V., Piterman, N., Uchitel, S., 2013. Synthesizing component-based middleware platform for reconfigurable service-oriented ar-
nonanomalous event-based controllers for liveness goals. ACM Trans. Softw. chitectures. Software 42 (5), 559–583. doi:10.1002/spe.1077.
Eng. Methodol. 22 (1), 9:1–9:36. doi:10.1145/2430536.2430543. Tichy, M., Klöpper, B., 2012. Planning self-adaption with graph transformations. In:
Dumitrescu, E., Girault, A., Marchand, H., Rutten, É., 2010. Multicriteria optimal re- Proc. 4th Int. Conf. on Applications of Graph Transformations with Industrial
configuration of fault-tolerant real-time tasks. In: Workshop on Discrete Event Relevance, pp. 137–152. doi:10.1007/978- 3- 642- 34176- 2_13.
Systems, WODES’10. IFAC, Berlin, Germany, pp. 366–373. Warren, I., Sun, J., Krishnamohan, S., Weerasinghe, T., 2006. An automated formal
Filieri, A., Ghezzi, C., Tamburrelli, G., 2011. Run-time efficient probabilistic model approach to managing dynamic reconfiguration. In: Proceedings of the 21st
checking. In: Proceedings of the 33rd International Conference on Software En- IEEE/ACM International Conference on Automated Software Engineering. IEEE
gineering. ACM, New York, NY, USA, pp. 341–350. doi:10.1145/1985793.1985840. Computer Society, Washington, DC, USA, pp. 37–46.
Filieri, A., Hoffmann, H., Maggio, M., 2014. Automated design of self-adaptive soft- Weyns, D., Malek, S., Andersson, J., 2012. Forms: unifying reference model for formal
ware with control-theoretical formal guarantees. In: Proceedings of the 36th specification of distributed self-adaptive systems. ACM Trans. Auton. Adapt. Syst.
International Conference on Software Engineering. ACM, New York, NY, USA, 7 (1), 8:1–8:61. doi:10.1145/2168260.2168268.
pp. 299–310. doi:10.1145/2568225.2568272. Xing, Z., Stroulia, E., 2005. Umldiff: an algorithm for object-oriented design differ-
Filieri, A., Hoffmann, H., Maggio, M., 2015. Automated multi-objective control for encing. In: Proceedings of the 20th IEEE/ACM International Conference on Au-
self-adaptive software design. In: Proceedings of the 2015 10th Joint Meeting tomated Software Engineering. ACM, New York, NY, USA, pp. 54–65.
on Foundations of Software Engineering. ACM, New York, NY, USA, pp. 13–24.