by Raphael Hiesgen, Dominik Charousset, Thomas C. Schmidt and Matthias Wählisch

The Internet of Things (IoT) enables a large number of devices to cooperate to achieve a common task. Each individual device is small and executes a confined software core. Collective intelligence is gained from distributed collaboration and Internet communication. Corresponding IoT solutions form large distributed software systems that pose professional requirements: scalability, reliability, security, portability and maintainability. The C++ Actor Framework CAF [1] contributes such a professional open source software layer for the IoT. Based on the actor model of Hewitt et al. [2], it aids programmers at a good level of abstraction without sacrificing performance.

The Internet of Things (IoT) is composed of many nodes, often with limited capabilities. Small software components that communicate via Internet protocol standards typically form a highly distributed work flow among machines with minimal human interaction. Traditional application scenarios include sensor networks that monitor data such as environmental or cyber-physical conditions. In addition to sensors, IoT networks include actuators that influence the environment. Complex applications are built from these nodes, for example: home automation, and tracking of health data. These systems enable machines to upload data to Internet servers, a task that originally required human interaction. Thus, they allow the tracking of data everywhere and anytime.

The main challenge for developers is to ensure an appropriate service quality even in unstable IoT environments. While working on a network of constrained machines, they need to supply synchronization primitives as well as mechanisms for error detection and propagation. To address these challenges, many developers fall back to low-level coding that requires specialized knowledge and is hard to maintain. As a result, code is barely portable, and often hand-crafted, which introduces high complexity, many sources of errors and little generality.

A distributed software layer as part of an operating system (OS) for embedded devices can resolve these challenges. While the OS eases portability and provides a standardized API for low-level functionality, the software layer uses these interfaces to provide a high abstraction for the application developer. For this purpose, we contribute the C++ Actor Framework (CAF) [1]. It is developed as an open source project at the Hamburg University of Applied Sciences and is open for contributions from the community. CAF enables asynchronous communication between nodes by a reliable message passing facility. Following the 'shared nothing' paradigm of actors, it provides synchronization primitives as well as error handling capabilities at very low overhead. CAF runs on RIOT [3], the friendly operating system for the IoT.

As early as 1973, Hewitt et al. [2] proposed the (abstract) actor model to address the problems of concurrency and distribution. This model defines entities called actors, which are concurrent, isolated and solely interact via network-transparent message passing based on unique identifiers. As a result, actors cannot corrupt the state of other actors. Furthermore, an actor can create new actors by an operation called spawn. This is often used to distribute workload, e.g., in a divide and conquer approach where actors divide problems and spawn new actors to handle the subproblems concurrently. Furthermore, the actor model specifies error handling capabilities for distributed systems that allow for monitoring of subsystems and aim at avoiding intermediate state in the network. Letting a runtime environment handle low-level functionality gives developers more time to focus on the application logic.

Our C++ Actor Framework has elaborated this model to allow for development of native software at a high abstraction layer without sacrificing performance. We provide exchangeable implementations of the runtime environment to make optimized use of system resources. This allows CAF to scale up to large performance-critical applications and down to small embedded devices. Its flexibility enables developers to test and verify their code on desktop machines before re-compiling and deploying the software on low-end devices. Hence, CAF provides a seamless development cycle, aiding developers to ship only well-tested components to the IoT. CAF can fill the gap between the high level of abstraction offered by the actor model and an efficient, native runtime environment.

IoT environments introduce specific constraints such as lossy networks, low-powered nodes, and communication capabilities limited to small packet sizes and intermittent connectivity. The original actor model was built on a strong coupling between components and cannot directly be transferred to the IoT. For example, the distributed error handling capabilities were not designed with constraints in mind and require adjustment. Furthermore, security mechanisms are not included and left to the runtime environment. However, IoT devices often carry private or critical data, require reliably and should remain resilient against node tampering. Hence, it is critical to provide encrypted communication as well as an authentication and authorization scheme for nodes.

Figure 1: The CAF distributed software layer adds transactional message passing to IoT nodes.

Figure 1: The CAF distributed software layer adds transactional message passing to IoT nodes.

We adapted CAF to the IoT environment by a new, loosely coupled communication layer as depicted in Figure 1. Part of its design is a transactional message-passing based on the request-response model offered by CoAP. This protocol offers the option of reliable message exchange as well as duplicate message detection. Each message exchange is independent and less vulnerable to connection failures than a coherent data stream. Our runtime environment can provide error propagation and mitigation in cases where messages cannot be delivered after multiple retries.

A major focus in our adaption is a new network stack. The default implementation of CAF focuses on locally distributed hardware with many cores. As such, the network stack is built on TCP/IP in a straight-forward manner. In contrast, for the IoT, our transactional network stack targets IEEE 802.15.4 or Bluetooth LE. The IP layer deploys 6LoWPAN to sustain IPv6 compatibility, while UDP is used at the transport layer. With regard to security we rely on DTLS for encryption. Further, we are working on an authentication concept for IoT environments based on ID-based cryptography. Corresponding message exchanges will use the request-response model of CoAP.

As the number of devices connected to the IoT is expected to rise significantly in the coming years, we anticipate a severe demand for professionalizing application development in this domain. Consequently, a programming environment that offers a high level of abstraction on native code is needed to build robust and scalable applications of appropriate robustness and performance. We believe that CAF presents a promising advancement towards 'Programming the IoT' - conjointly with the embedded operating system RIOT.

Links:
http://www.actor-framework.org
http://riot-os.org

References:
[1] D. Charousset, R. Hiesgen, T.C. Schmidt: “CAF - The C++ Actor Framework for Scalable and Resource-efficient Applications”, in proc. of the 5th ACM SIGPLAN SPLASH '14, Workshop AGERE!, ACM, 2014.
[2] C. Hewitt, P. Bishop, R. Steiger: “A Universal Modular ACTOR Formalism for Artificial Intelligence”, in proc. of the 3rd IJCAI, San Francisco, CA, USA, 1973, Morgan Kaufmann Publishers Inc., pp. 235-245.
[3] E. Baccelli, et al.: “RIOT OS: Towards an OS for the Internet of Things”, in proc. of the 32nd IEEE INFOCOM, Poster (Piscataway, NJ, USA, 2013), IEEE Press.

Please contact:
Dominik Charousset, Raphael Hiesgen, Thomas C. Schmidt
Hamburg University of Applied Sciences, Hamburg, Germany
E-mail: {dominik.charousset,raphael.hiesgen,t.schmidt}@haw-hamburg.de

Matthias Wählisch
Freie Universität Berlin, Germany
E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.

Next issue: January 2025
Special theme:
Large-Scale Data Analytics
Call for the next issue


Image ERCIM News 101 epub
This issue in ePub format

Get the latest issue to your desktop
RSS Feed