JSEVAsync: An Asynchronous Event-based Framework to Energy Saving on IoT Devices
Resumo
Typically the Internet of Things devices are constrained in terms of processing, memory, and energy consumption. Energy consumption is a critical aspect of these devices, being heavily impacted by how programs are developed, and it becomes more evident in interpreted languages that naturally demand more resources. Commonly embedded software development uses Time-triggered (TT) and Event-triggered (ET) architectures to design embedded projects. However, the TT strategy can consume more energy due to the polling method; in contrast, the ET approach can be energy-efficient but cannot deal with multiple events. This paper introduces JSEVAsync, a framework to help developers to design applications using JavaScript language for IoT devices that combine the best parts of TT and ET architectures. This approach uses JavaScript's non-blocking concept as a development interface to structure the algorithms into asynchronous events. To validate it, we compare C- and JavaScript-based applications and analyze the results from the energy consumption perspective. We found that writing code through JSEVAsync can be up to 21% more energy efficient than the traditional method. Moreover, JavaScript can improve design-time aspects such as readability, maintainability, and code reuse.