Automated Distributed Implementation of Component-Based Models with Priorities Borzoo Bonakdarpour, Marius Bozga, Jean Quilbeuf
Total Page:16
File Type:pdf, Size:1020Kb
Automated Distributed Implementation of Component-Based Models with Priorities Borzoo Bonakdarpour, Marius Bozga, Jean Quilbeuf To cite this version: Borzoo Bonakdarpour, Marius Bozga, Jean Quilbeuf. Automated Distributed Implementation of Component-Based Models with Priorities. 1th International Conference on Embedded Software, EM- SOFT 2011, Oct 2011, Taipei, Taiwan. pp.59-68, 10.1145/2038642.2038654. hal-00722405 HAL Id: hal-00722405 https://hal.archives-ouvertes.fr/hal-00722405 Submitted on 1 Aug 2012 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Automated Distributed Implementation of Component-based Models with Priorities∗ Borzoo Bonakdarpour Marius Bozga Jean Quilbeuf School of Computer Science VERIMAG, Centre Équation VERIMAG, Centre Équation University of Waterloo 2 avenue de Vignate 2 avenue de Vignate 200 University Avenue West 38610, GIÈRES, France 38610, GIÈRES, France Waterloo, Canada, N2L3G1 [email protected] [email protected] [email protected] ABSTRACT and Meanings of Programs]: Specifying and Verifying In this paper, we introduce a novel model-based approach for and Reasoning about Programs—Logic of programs; I.2.2 constructing correct distributed implementation of [Artificial Intelligence ]: Automatic Programming—Pro- component-based models constrained by priorities. We ar- gram transformation gue that model-based methods are especially of interest in the context of distributed embedded system due to their General Terms inherent complexity. Our three-phase method’s input is a model specified in terms of a set of behavioural components Theory, Design, Languages, Reliability, Performance that interact through a set of high-level synchronization primitives (e.g., rendezvous and broadcasts) and priority rules for scheduling purposes. Our technique, first, trans- Keywords forms the input model into a model that has no priorities. Component-based modeling, Automated transformation, Then, it transforms the deprioritized model into another Distributed systems, BIP, Correctness-by-construction, model that resolves distributed conflicts by incorporating a Committee coordination, Conflict resolution. solution to the committee coordination problem. Finally, it generates distributed code using asynchronous point-to- point send/receive primitives. All transformations preserve 1. INTRODUCTION the properties of their input model by ensuring observational equivalence. The transformations are implemented and our Correct design and implementation of computing systems experiments validate their effectiveness. has been an ongoing research topic in the past three decades. This problem is significantly more challenging in the context Categories and Subject Descriptors of distributed systems due to a number of factors such as non-determinism, non-atomic execution of processes, race C.2.4 [Computer-Communication Networks]: conditions, and occurrence of faults. Correctness of dis- Distributed Systems[Distributed applications] tributed implementations is of significant importance in the ; D.1.3 [Programming Techniques]: Concurrent Program- context of embedded applications, as such applications are ming—Distributed programming, Parallel programming often employed in safety-critical systems. Model-based de- ; D.2.13 [Software Engineering]: Reusable Software— velopment of embedded distributed applications aims at in- Reuse models; D.4.7 [Operating Systems]: Organization creasing their integrity by using explicit models employed in and Design—Real-time and embedded systems; F.3.1 [Logics clearly defined transformation steps leading to correct-by- ∗The research leading to these results has received funding construction artifacts. This approach is beneficial, as one from the European Community’s Seventh Framework Pro- can ensure functional correctness of the system by dealing gramme [FP7/2007-2013] under grant agreement no 248776 with a high-level formally specified model that abstracts im- (PRO3D) and no 257414 (ASCENS), from ARTEMIS JU plementation details and then derives a correct implemen- grant agreement ARTEMIS-2009-1-100230 (SMECY) and tation through a series of transformations that terminates from Canada ORF RE03-045, NSERC DG 357121-2008, and when an actual executable code is obtained. IS09-06-037 grants. In this paper, we focus on the BIP framework [5] as our formal modelling language. BIP (Behaviour, Interaction, Priority) is based on a semantic model encompassing com- Permission to make digital or hard copies of all or part of this work for position of heterogeneous components. The behaviour of personal or classroom use is granted without fee provided that copies are components is described as an automaton or Petri net ex- not made or distributed for profit or commercial advantage and that copies tended by data and functions given in C++. BIP uses a bear this notice and the full citation on the first page. To copy otherwise, to diverse set of composition operators for obtaining compos- republish, to post on servers or to redistribute to lists, requires prior specific ite components from a set of components. The operators are permission and/or a fee. EMSOFT'11, October 9–14, 2011, Taipei, Taiwan. parametrized by a set of interactions between the composed Copyright 2011 ACM 978-1-4503-0714-7/11/10 ...$10.00. components. Finally, priorities are used to specify different scheduling mechanisms1. Transforming a BIP model into a BIP model 1 Deprioritized 2 Distributed distributed implementation involves addressing three funda- Multiparty BIP model BIP model mental issues: interactions Multiparty Send/Receive + Priorities interactions interactions 1. Concurrency: Components and interactions should be able to run concurrently while respecting the se- 3 quential semantics of the high-level model. Distributed code 2. Conflict resolution: Interactions that share a common component can potentially conflict with each other. Figure 1: Steps for generating a distributed imple- mentation from a high-level BIP model. 3. Enforcing priorities: When two interactions can execute simultaneously, the one with higher priority must be executed. are non-uniform. Hence, in order to improve the per- formance, it is reasonable to devise algorithms that These issues introduce challenging problems in a give priority to groups that require resources with higher distributed setting. The conflict resolution issue can be ad- demand. A concrete example of group mutual exclu- dressed by incorporating solutions to the committee coordi- sion is the well-known readers/writers problem. In nation problem [9] for implementing multiparty interactions. most cases, we give priority to readers to improve the For example, Bagrodia [2] proposes different solutions with performance. different degrees of parallelism. The most distributed solu- tion is based on the drinking philosophers problem [8], and • Reducing non-determinism. Non-determinism has inspired the approaches by P´erez et al. [14] and Parrow in distributed and concurrent computing is one of the et al. [13]. In the context of BIP, a transformation address- sources of obtaining a diverse set of behaviours. In ing all the three challenges through employing centralized many scenarios and in particular, in embedded appli- scheduler is proposed in [4]. Moreover, in [6,7], we pro- cations, it is desirable to guide the system to behave pose transformations that address the concurrency issue by in a certain predictable fashion. breaking the atomicity of interactions and conflict resolu- tion by embedding a solution to the committee coordination The main challenge in ensuring priorities in a distributed problem in a distributed fashion. On the contrary, designing setting is their correct implementation. This is due to the transformations that enforce priorities between interactions fact that components need to obtain a reliable knowledge in a distributed setting remains unaddressed in spite of the about enabledness of interactions, so that only the inter- vital role specifying priorities plays in designing systems. action with highest priority is executed. In [3], the authors propose a model checking approach that determines whether actions of a given Petri net can be executed without violat- 1.1 Motivation ing priority rules. However, the downside of this approach is (1) it has scaling issues, as it uses model checking, and Priorities are widely used in system design, as a way of (2) in most cases the local knowledge of processes is shown scheduling events. Below, we present examples of how ap- to be insufficient to decide whether or not an action can be plying priorities can guide a system to satisfy certain prop- executed. Other approaches include applying customized al- erties: gorithms to implement priority rules for specific problems in distributed computing (e.g., [12]). • Ensuring safety. Safety properties are normally of These examples demonstrate the demand for developing the form “nothing bad happens during the system ex- methods that automatically construct a correct distributed ecution”. In the context of concurrent and distributed