# An Actor-Based Formal Model and Runtime Environment for Resource-Bounded IoT Services +
## 1 Introduction  
An Internet of Things (IoT) system is an engineered system that integrates computational algorithms with physical sensing components and processes. The computational algorithms coordinate and communicate with sensors that monitor cyber and physical indicators, along with actuators that modify the cyber and physical environment [1]. Such smart IoT systems use sensors to connect all distributed intelligence in the environment to gain a more in-depth knowledge of the environment, which enables more accurate actions and tasks. IoT systems can scale to billions of end-devices (i.e., sensors and actuators) connected to gateways, which act as the aggregation points for a group of sensors and actuators to coordinate the connectivity of these devices to each other and to an external network [2]. IoT systems open up an opportunity to offer innovative IoT services that can take advantage of the data collected by different sensors across a wide variety of domains, including health-care, agriculture, entertainment, environmental monitoring, and transportation, etc. [3]. Consider a livestock-monitoring IoT service that utilizes a set of in-situ sensors mounted in a livestock farm to collect data regarding the location, well-being, and health of cattle. This information would help farmers identify diseased animals to beseparated from the herd, thereby preventing the spread of diseases. IoT services could also help coordinate rescue efforts following natural disasters, such as the hurricanes Harvey and Irma in 2017 in Texas and Florida, respectively. Emergency agencies could use such services to gain insight into the situation on the ground. IoT services have a communication pattern in which contextual data offered by a number of contributors become the basis for services [4]. Increasingly, sensed data could inform decisions to activate actuators to carry out tasks automatically. A growing number of IoT-based home automation technologies offer good examples of such capability. Although there is growing body of work on different aspects of IoT services (e.g., [5; 6; 7]), research in each of these areas so far has been largely focused on either technology addressing specific challenges [8; 9] or particular applications [3; 10]. Moreover, the technologies developed in one area do not readily migrate to the other because of the differences in the applications and device specifications involved in each area. Furthermore, developing such services is highly labor-intensive, where significant parts of the code have to be written from scratch. This is, in part, because of the lack of high-level language support for such services. In addition, IoT services often require complex communication and coordination mechanisms, which are not adequately supported by existing ones [11]. This paper proposes a formal model for representing resource-bounded IoT services, broadly founded in the actors model of concurrency [12]. The model allows key principles of IoT services to be rigorously studied. It provides a mechanism for specifying the creation and manipulation of IoT services. The model also identifies core mechanisms underlying IoT services, which inform design and implementation decisions about them if they are implemented over an IoT programming platform. The model also studies some important properties and propositions of IoT services and develops mechanisms for fine-grained resource coordination and control for such services. First, we precisely describe the syntax and operational semantics of the various types of distributed IoT services, and then develop a unifying model to better support them. We present a runtime environment, which implements the formal model, which is most readily applicable to resource-bounded IoT services. It offers high-level primitives supported using a middleware to implement key mechanisms required by such services, allowing service designers to focus on application-specific concerns. The proposed distributed runtime environment supports the deployment and execution of IoT services.