Distributed prototyping from validated specifications

https://doi.org/10.1016/S0164-1212(03)00074-8Get rights and content

Abstract

We present vpl2cxx, a translator that automatically generates efficient, fully distributed C++ code from high-level system models specified in the mathematically well-founded VPL design language. As the Concurrency Workbench of the New Century (CWB-NC) verification tool includes a front-end for VPL, designers may use the full range of automatic verification and simulation checks provided by this tool on their VPL system designs before invoking the translator, thereby generating distributed prototypes from validated specifications. Besides being fully distributed, the code generated by vpl2cxx is highly readable and portable to a host of execution environments and real-time operating systems (RTOSes). This is achieved by encapsulating all generated code dealing with low-level interprocess communication issues in a library for synchronous communication, which in turn is built upon the adaptive communication environment (ACE) client-server network programming interface. Finally, example applications show that the performance of the generated code is very good, especially for prototyping purposes. We discuss two such examples, including the RETHER real-time Ethernet protocol for voice and video applications.

Introduction

Ideally, developers of software for embedded and reactive systems would like to be able to produce high-level designs of their software that are abstract, understandable to domain/application experts, executable, and automatically verifiable. They would then like to be able to automatically generate efficient and certified code from their designs that can run on a wide variety of execution platforms and real-time operating systems (RTOSes). Even if the code produced was not production-quality, it would at least function as a serviceable rapid system prototype that could be used to obtain useful feedback on run-time issues.

In this paper, we report on work inspired by this ideal. In particular, we present a framework in which systems are specified in VPL, an abstract system design language based on value-passing CCS, Milner’s well-known process calculus (Milner, 1989). VPL specifications can be processed using the front-end generated by the Process Algebra Compiler (PAC) (Cleaveland et al., 1995) for the Concurrency Workbench of the New Century (CWB-NC) (Cleaveland and Sims, 1996).1 The automatic simulation and verification facilities of the CWB-NC, which include model checking, equivalence checking and refinement checking, can then be applied to VPL designs in order to check their correctness. The tool described in the current paper may be used to generate C++ prototypes automatically from the analyzed designs. We refer to this approach to system design and implementation as model-based code generation; Fig. 1 gives an overview of this idea.

Our code generator, named vpl2cxx, uses the adaptive communication environment (ACE) network programming interface (Schmidt and Huston, 2002) so that the code it produces is portable to any operating system containing an implementation of the relevant ACE libraries. vpl2cxx also implements two efficient, fully distributed algorithms for scheduling input and output statements offered by different processes in a system: a randomized algorithm for the case where no restrictions are placed on the use of input and output commands as guards in VPL nondeterministic select statements; and a deterministic algorithm for VPL specifications in which output guards are prohibited, á la the programming languages occam (Jones, 1989) and Ada 95 (Taft and Duff, 1997). The randomized algorithm places no restrictions at the VPL level regarding the use of nondeterminism, and the resulting code is a faithful implementation of the VPL description from which it is derived.

Finally, the generated C++ code is highly readable––owing largely to the fact that all generated code dealing with low-level interprocess communication issues is encapsulated in a library for synchronous communication, which is implemented as a layer on top of the ACE NPI––and bears a strong structural resemblance to the corresponding VPL specification. Readability of the generated code facilitates code maintenance and evolution, and it is also important for promoting acceptance of this technology, since engineers can inspect the resulting C++ code manually.

To assess the feasibility of the proposed approach, we have applied vpl2cxx to several examples, including the well-known dining philosophers problem and the RETHER real-time Ethernet protocol for voice and video applications (RNI01, 2001). Our performance figures indicate that code produced by vpl2cxx delivers more-than-acceptable performance for a distributed prototype.

The focus of this paper is code generation, that is, the rapid prototyping of distributed implementations from VPL designs. A closer examination of the PAC front-end generator and the Workbench’s verification and simulation capabilities can be found in Cleaveland et al. (1995) and Cleaveland and Sims (1996), respectively.

The rest of the paper develops along the following lines. Section 2 presents the VPL specification language. Section 3 discusses the library for synchronous communication utilized by the code generator to achieve maximal platform independence, and its implementation using the ACE NPI. Section 4 describes the VPL-to-C++ translator underlying the code generator. The dining philosophers and RETHER case studies are the subject of Section 6, while Section 8 offers our concluding remarks. For more details on the code-generation work described here, the reader is referred to Hansel (2000).

Section snippets

VPL

VPL is intended to support the specification of hierarchical systems of concurrent processes that communicate via message passing over typed channels. The VPL type system includes integers of limited range as well as array and record type constructors. There is also a special type synch for channels that transport no data and can only be used for process synchronization. Message passing in VPL is binary and synchronous, requiring a handshake between the sender and receiver for communication to

Library for synchronous communication

This section describes the library for synchronous communication upon which vpl2cxx is built. We were faced with two primary challenges in implementing the library. Firstly, communication in VPL is synchronous, whereas the basic communication primitives accessible from ACE are asynchronous. The second problem is the presence of input and output guards in VPL, i.e. send and receive statements appearing as the initial commands in select statement alternatives. In such a setting, obtaining a

The VPL to C++ translator

The vpl2cxx translator translates VPL processes and networks into stand-alone programs. In the case of a network, the resulting program contains code for starting servers for local channels and for executing the subsystems contained in the network body. The user has the option of generating a Unix shell script or stand-alone C++ program for this purpose. The translation of VPL processes is relatively straightforward due to the presence of the synchronous communication library discussed above.

Protocols for input/output guard scheduling

We now present the deterministic and randomized protocols for input/output guard scheduling we implemented as part of our library for synchronous communication. The two protocols share several important attributes:

  • Both protocols possess a client/server architecture, with a client process for each VPL process and a server process for each VPL channel. (Recall that communication in VPL is binary, synchronous, and channel-oriented.)

  • The client code for handling synchronous input and output in a

Experimental results

This section compares the performance of vpl2cxx-generated C++ code with that of hand-written C++ code. Two applications are considered: the well-known dining philosophers problem, and a real-time Ethernet protocol.

Related work

A number of specification and verification tool suites provide some form of code generation, differing in terms of the specification language supported, the kinds of analyses allowed on specifications, the target programming language, and intended execution platform of the generated code (e.g. sequential, shared-memory, distributed). Table 3 gives a representative sampling of such tools. (The column entitled “Graphical?” in Table 3 indicates for each tool whether the specification notation

Conclusions

We have presented vpl2cxx, a translator that automatically generates distributed C++ prototypes from validated VPL specifications. The translator is built around a library for synchronous communication and nondeterministic selection of communication guards, resulting in generated code that is readable and portable. The library includes implementations of two new client/server-based algorithms for the input/output guard scheduling problem: a deterministic protocol for VPL specifications in which

Acknowledgements

We would like to thank the anonymous referees for their valuable comments and Yuh-Jzer Joung for answering our questions about the complexity of the guard-scheduling problem. This research was supported in part by the National Science Foundation, grants CCR-9505562 and CCR-9988155, and the Army Research Office, grants DAAD190110003 and DAAD190110019.

References (29)

  • Y.-J. Joung

    Two decentralized algorithms for strong interaction fairness for systems with unbounded speed variability

    Theoretical Computer Science

    (2000)
  • D.C. Schmidt et al.

    The design and performance of real-time object request brokers

    Computer Communications

    (1998)
  • A.W. Appel et al.

    Standard ML of New Jersey

  • Basu, A., Morrisett, G., von Eieken, T., 1998. Promela++: a language for constructing correct and efficient protocols....
  • Bosco, B.G., Martini, G., Giudice, D.L., Moiso, C., 1997. An environment for specifying, developing and generating TINA...
  • S. Chachkov et al.

    From an abstract object-oriented model to a ready-to-use embedded system controller

  • R. Cleaveland et al.

    Generating front-ends for verification tools

  • R. Cleaveland et al.

    The NCSU Concurrency Workbench

  • X. Du et al.

    Local model checking and protocol analysis

    Software Tools for Technology Transfer

    (1999)
  • Francez, N., Rodeh, M., 1980. A distributed abstract data type implemented by a probabilistic communication scheme. In:...
  • Garavel, H., 1998. OPEN/CÆSAR: an open software architecture for verification, simulation, and testing. In: Proc. 4th...
  • Garland, S.J., Lynch, N.A., 1998. The IOA language and toolset: support for designing, analyzing, and building...
  • B. Grahlmann

    The State of PEP

  • Hansel, D., 2000. Generating C++ code from VPL specifications. Master’s thesis, Technical University of...
  • Cited by (3)

    View full text