## 2 Understanding WebAssembly
### Overview of WebAssembly  
WebAssembly, colloquially known as Wasm, is a stack-based virtual machine [11]. It was designed as a portable target for the compilation of high-level languages such as C, C++, and Rust, enabling deployment on the web for client and server applications. Wasm provides a compact binary format that is designed to be fast to decode and execute. In addition, it is designed to be safe, operating inside a sandboxed environment separated from the host system. Wasm provides a compelling target for a range of programming languages. Wasm operates in conjunction with JavaScript, often as a complementary technology. While JavaScript does not \"compile\" to Wasm, it is important to understand that JavaScript interacts with Wasm modules in browsers, facilitating communication between the DOM and Wasm functions. Currently, it supports C, C++, Rust, Assembly Script, C#, F#, Dart, Go, Kotlin, Swift, D, Pascal, Zig, and Grain. * **The Rationale Behind WebAssembly** The introduction of Wasm was in response to the need for an efficient low-level code representation that could be processed effectively within the stringent performance constraints of web environments. Over the course of their evolution, web applications have grown in complexity, requiring more computational resources and demanding superior performance from client-side scripts. JavaScript, while instrumental in the development and functionality of these applications, has limitations in terms of performance optimization that have become more evident with the increasing complexity of web tasks. Wasm was developed to address this performance gap, complementing JavaScript by running complex computational tasks at near-native speed. This  
Figure 1: Organization of the paper. leap in performance opens up new possibilities for web-based applications, allowing them to handle more complex tasks that have traditionally been the domain of desktop applications. * **Portability and Interoperability** A key attribute of Wasm is its design as a portable bytecode that can be executed across a variety of platforms. This universality makes it a versatile tool in heterogeneous environments, including the IoT, where devices of various types are interconnected. A Wasm module can run on any platform that hosts a compliant Wasm virtual machine, irrespective of the device's specific hardware or operating system. The interoperability of Wasm is another key aspect of its design. It is designed to work in conjunction with JavaScript, leveraging the existing web platform's infrastructure. This interoperability allows for a smoother transition to Wasm, as developers can gradually replace performance-critical sections of JavaScript code with more efficient Wasm modules without disrupting the application's overall functionality. * **Safety and Security** Web technologies must prioritize safety and security, and Wasm is no exception. Wasm operates inside a secure sandbox environment separate from the host system, much as JavaScript does. This design restricts any potential malicious activity within the confines of the sandbox, providing a crucial layer of security. Even if an attacker manages to exploit a vulnerability within the Wasm code, they will be contained within the sandbox environment, mitigating the potential damage to the host system. * **Evolution and Community Engagement** Wasm has received substantial interest and support from both the developer community and industry giants such as Google, Mozilla, Microsoft, and Apple. This widespread backing coupled with active community engagement has fostered rapid evolution. There have been numerous improvements and extensions to the Wasm specification since its initial release, highlighting the ongoing development of this powerful technology. The community engagement around Wasm drives its evolution and aids in exploring new possibilities for its application across various domains, including IoT.