# An Actor-Based Formal Model and Runtime Environment for Resource-Bounded IoT Services +
## 6 A Distributed Runtime Environment for IoT Services  
To narrow the gap between the generation of sensor data and its interpretation, novel artificial-intelligence (AI) methods are critically needed to smartly analyze and process the vast amount of sensor data on the network's edge. This section presents the design of an AI-powered runtime environment for smart sensing to support the programmability of IoT services.  
The proposed runtime environment offers an adaptable, configurable, highly reliable, and reuse-driven sensing platform that can be easily reused in the development of IoT services. This platform will open new opportunities to explore various sensor fusionarchitectures, including sensory front end, read-out electronics, power systems with respect to volume, mass, and power consumption. Figure 4 illustrates the software stack of the proposed AI-power platform for smart sensing, which will include three layers:  
**Hardware abstraction layer (HAL):** HAL is a software layer which enables access to the hardware components of IoT devices such as random-access memory (RAM), read-only memory (ROM), and serial interfaces, etc. This layer provides an innovative hardware building block with computation, storage, communication, and re-programmability, as well as various heterogeneous computing elements of a GPU, a central processing unit (CPU), digital signal processing (DSP), field programmable gate arrays (FPGAs), and a tensor processing unit (TPU) to meet various IoT sensing requirements. It also includes real-time operating systems (RTOS) and IoT firmware that are particularly suited for small and constrained devices, and that can provide IoT-specific capabilities.  
**AI-powered runtime environment**: The AI-enabled runtime environment will run over the HAL layer. It hosts several sensor modules which can interact with the ML models through a senor bus over the network. This layer also provides a register-transfer-level (RTL) intellectual property (IP) cores library. The RTL/IP core implements a set of parameterizable DSP algorithms commonly used by IoT sensors and other communication IP cores for building a complete sensor-data processing system.  
**Smart sensing platform**: IoT applications are deployed on top of the runtime environment. Applications are defined as a workflow of functions, where each function can provide data generation (e.g., in-situ sensors), processing, and data consumption (e.g., actuators). Function-code execution is triggered by specific events such as receiving new sensing data from a sensor locally or remotely, or detecting a change in the state of a sensor. Furthermore, this layer includes an IoT benchmark for performance validation and resource usage estimation, and a collection of test procedures, scripts, test benches, and other monitoring and debugging utilities that can be reused for algorithm development and the IoT ecosystem implementation. In addition, we developed an integrated IoT toolchain which will provide a complete design flow starting from dataflow architectural exploration, model development, resource optimization to physical implementation based on the platform components.  
The runtime environment enables programmers to write a single actor program which will automatically become distributed to run on many devices at the edge of the network. Actors are the building blocks for an application which will be deployed on the top the runtime environment. The actors are connected in a dataflow to form the application. This simplifies actor migration between runtimes and the matching of actor requirements  
Figure 4: The proposed AI-power platform for smart sensing.  
with runtime capabilities. If the runtime does not meet the requirements posed by a deployed actor, then the actor will be automatically migrated to a runtime that can satisfy the requirements.