VOOZH about

URL: https://thenewstack.io/why-webassembly-is-perfect-for-tiny-iot-devices/

⇱ Why WebAssembly Is Perfect for Tiny IoT Devices - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-04-07 10:00:41
Why WebAssembly Is Perfect for Tiny IoT Devices
sponsor-cncf,sponsored-post-contributed,
Cloud Native Ecosystem / WebAssembly

Why WebAssembly Is Perfect for Tiny IoT Devices

Wasm is a lightweight, efficient, secure runtime that's perfect for devices with limited resources. It's also flexible and platform-independent, which makes it easy to develop applications for a wide range of hardware.
Apr 7th, 2023 10:00am by Dan Mihai Dumitriu
👁 Featued image for: Why WebAssembly Is Perfect for Tiny IoT Devices
Image via Pixabay.
CNCF sponsored this post.
This post is part of a series that provides a preview of KubeCon + CloudNativeCon Europe 2023, which will be held April 18-21 in Amsterdam. Join us there to learn more about the transformative nature of cloud native applications and open source software.

As the world becomes more interconnected, the number of Internet of Things (IoT) devices has exploded. These devices come in a wide range of shapes and sizes, from massive industrial machines to tiny sensors. While larger devices may run on Linux or other operating systems, smaller devices require a different approach. In this article, I’ll explain why WebAssembly (Wasm) is the perfect runtime for tiny IoT devices that are too small for Linux and may need to run on battery power.

Challenges

First, let’s look at the challenges of running a traditional operating system on tiny IoT devices. These devices are typically low-powered and have limited memory and storage capacity. Running a full-blown operating system such as Linux requires a significant amount of resources, which can quickly drain the battery life of the device.

Additionally, these devices may not have the hardware necessary to support a full Linux OS, such as MMU (memory management unit) required for hardware virtual memory. Various RTOS (Real Time Operating Systems) exist for tiny IoT devices — some examples include FreeRTOS, ThreadX, and NuttX. As such, we cannot use Linux containers (aka Docker) as a unit of isolation on these tiny IoT devices.

KubeCon + CloudNativeCon conferences gather adopters and technologists to further the education and advancement of cloud native computing. The vendor-neutral events feature domain experts and key maintainers behind popular projects like Kubernetes, Prometheus, Envoy, CoreDNS, containerd and more.
Learn More
The latest from KubeCon + CloudNativeCon

Second, the traditional development cycle for embedded systems, like IoT devices, differs significantly from that of cloud software. Although making changes to the code may be uncomplicated, delivering them to customers is a complex process. Typically, there is a monthly code freeze, during which all modifications undergo thorough hardware-in-the-loop testing, potentially on many types of devices.

Following successful testing of the new release, a staged rollout process is initiated to prevent issues with firmware updates, customer complaints or support escalations. It may take several weeks, or even months, for a minor code change to reach most customers. This process is no longer acceptable in the era of agile development and the cloud.

WebAssembly

Enter WebAssembly. Wasm is a stack-based virtual machine and bytecode format. Originally designed for web browser plugins, it is not limited to just web applications. It’s a versatile runtime that can be used for a wide range of applications, including IoT devices. Wasm is designed to be small and efficient, which makes it a great fit for tiny IoT devices.

Wasm modules are typically a few kilobytes in size, which is much smaller than a typical Linux kernel or a Linux container. This small size means that Wasm can run on devices with limited memory and storage capacity, with native performance.

Another advantage of using Wasm for IoT devices is that it’s a platform-independent runtime. This means that Wasm modules can be written in any programming language and executed on any platform that supports Wasm. This flexibility makes it easy to develop applications for IoT devices, regardless of the hardware or software environment.

Developers can write code in their preferred programming language, and then compile it to Wasm, which can be executed on the target device. C, C++, Rust, JavaScript are well supported. Languages that require garbage collection are less well supported, but that is due to change as the Wasm spec evolves.

Wasm modules are executed in a sandboxed environment, which means that they’re isolated from the rest of the system. This makes it difficult for attackers to exploit vulnerabilities in the system, as they’re unable to access the underlying operating system or hardware. This is particularly important for tiny IoT devices which have no virtual memory. Additionally, Wasm modules can be verified, ahead of deployment, and signed, which adds an extra layer of security to the system.

Some Wasm runtimes support AoT (Ahead of Time) compilation, which takes the Wasm bytecode and produces machine code for the target CPU/MCU type. This is very useful, or even essential, in the context of tiny IoT devices, which may not have the available CPU and memory to perform JIT (Just in Time) compilation, as we typically do in the cloud or on the desktop.

The AoT compilation can be part of a cloud service which manages the life cycle of software deployed on the IoT devices. AoT-compiled code can run nearly at native speeds and orders of magnitude faster than interpreted languages like Micropython.

Maturity

While Wasm has been around for several years, it’s still a relatively new technology. There are not as many tools and libraries available for Wasm as there are for traditional programming languages and frameworks. Some parts of the Wasm spec are still evolving, such as native support for GC required by popular languages like Python. However, this is changing rapidly, as more and more developers adopt Wasm for a variety of applications.

Another difficulty of using Wasm for IoT devices is the lack of support for hardware-specific functionality. Since Wasm is a platform-independent runtime, it doesn’t have direct access to the hardware of the device, or to peripherals such as sensors.

Developers must use a combination of Wasm and native code to access the hardware of the device, and create a WASI API extension that abstracts the hardware functionality and exposes it to the Wasm module. The Wasm community is working to standardize various system interfaces in the WASI (WebAssembly System Interface) specification.

Conclusion

Overall, the benefits of using Wasm for IoT devices far outweigh the potential drawbacks. Wasm is a lightweight, efficient, secure runtime that’s perfect for devices with limited resources. It’s also flexible and platform-independent, which makes it easy to develop applications for a wide range of hardware and software environments, and bring agile development to tiny IoT devices.

As the number of IoT devices continues to grow, Wasm will become an increasingly important tool for developers who are looking to create efficient and secure applications for these devices. With the increasing importance of edge computing and the rise of IoT, it’s clear that WebAssembly is set to play a significant role in the future of computing.

The Cloud Native Computing Foundation (CNCF) hosts critical components of the global technology infrastructure including Kubernetes, OpenTelemetry, and Argo. CNCF is the neutral home for cloud native collaboration, bringing together the industry’s top developers, end users, and vendors.
Learn More
The latest from CNCF
TRENDING STORIES
Dan Mihai Dumitriu is Chief Technology Officer of Midokura, a Sony Group company, leading an R&D team for advanced development of edge computing and AI technologies. He is passionate about distributed systems, data center networks, and software architecture. At Logitech,...
Read more from Dan Mihai Dumitriu
CNCF sponsored this post.
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Real, Pragma, Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.