The vast majority of IoT devices rely on some form of RTOS, of which Zephyr and FreeRTOS are just two of many options. But they are by no means created equal, and there are some significant differences in the way they operate in IoT.
Let’s begin by talking about what an RTOS is and how it fits into the IoT ecosystem and then we’ll discuss the ways these two RTOS options differ.
What is an RTOS in IoT?
IoT devices are generally small, so unlike your PC, they don’t have nearly endless room for all the storage and processing hardware you could ever need. That’s why IoT devices often rely on something called a Real-Time Operating System (RTOS) instead of a traditional operating system. An RTOS performs a single task in real-time rather than multiple tasks more slowly like a traditional OS, for example Linux, Windows, or iOS.
There’s actually a third option in addition to an RTOS or OS: bare metal. A bare metal device runs a single application rather than a full actual operating system. To understand the difference between this and an RTOS or OS, think about how your computer can run various different applications over the course of a day.
For example, Windows might be the operating system, but you can run various applications like Microsoft Word, a photo editing application, etc. An OS can run several of those applications simultaneously. An RTOS will switch between applications to run them one at a time much faster. By contrast, a bare metal device is created specifically for one application.
Many IoT devices – say, smart watches – are small but might need to run several different applications over the course of a day, such as health monitoring applications, GPS applications, and more. For these needs, an RTOS is the most common option.
What Are the Differences Between Zephyr and FreeRTOS?
The most obvious difference between Zephyr and FreeRTOS is the creators of these two RTOS options. Zephyr was created as an open-source project by the Linux Foundation with a focus on security and fostering a vast community of contributors. FreeRTOS is also open-source but was developed by Amazon AWS in large part as a complement to the company’s cloud services for IoT devices.
The second difference is the type of OS. While Zephyr and FreeRTOS are both considered Real-time Operating Systems, the reality is that FreeRTOS is so small in terms of energy usage and computing power that it’s almost in the category of a bare metal operating system. FreeRTOS has fewer features and less processing capabilities than Zephyr, so while it can potentially be used to run more than one application, it’s still best suited for use cases where the IoT device only has a single application.
An example might be a smart proximity sensor in a security system. The only function the device needs to fulfill is to sense and alert the IoT system if something or someone comes close to the sensor. So while Zephyr might be better for a smartwatch or other wearable device, for example, FreeRTOS might be better suited for a proximity sensor.
The third difference is in the developmental ecosystem and complexity for the respective RTOS products. Zephyr is an open-source contribution ecosystem that has built a strong community and documentation around its developments. With a vast library of SDKs and a Linux-based architecture, Zephyr is great for experienced developers.
Unfortunately, Zephyr’s giant feature base has made it hard for some less experienced developers to get started. By contrast, FreeRTOS doesn’t have the same level of community as Zephyr, but it has the professional support of AWS behind it. Also, as a small and feature-light RTOS, it’s simple to use and deploy.
Finally, let’s talk about security. Having AWS as your data security provider comes with a certain amount of peace of mind. The company certainly has the resources to maintain data security and perform regular updates. That said, regular doesn’t necessarily mean frequent.
Compared to Zephyr RTOS, security updates for AWS are relatively few and far between. Zephyr provides long-term support, regular security updates, and a rigorously tested and auditable code base. These features are why, as of 2019, Zephyr RTOS achieved the Open Source Security Foundation (OpenSSF) Gold Badge, which is an award based on a project’s commitment to security.
Zephyr or FreeRTOS?
Your choice between Zephyr and FreeRTOS will depend on three primary factors: how much customization you want to do, how energy-constrained your IoT use case is, and whether you need a full-stack cloud communication platform on top of your IoT stack.
Let’s start with customization. As a feature-light RTOS that’s almost bare metal, FreeRTOS allows you to add whatever you want to it, but the developer time and experience required to do that can be extensive. By contrast, Zephyr is a Linux-based RTOS created for interoperability and flexibility. Considering the in-depth documentation and strong community around Zephyr, it’s no wonder that Zephyr remains a top choice for developers. Developers who are familiar with Linux can get started making changes right away, and with all of the tools available in the Zephyr ecosystem, you can adapt the Zephyr RTOS to virtually any IoT use case.
When it comes to more energy-constrained use cases, a bare metal OS like FreeRTOS provides the lowest level of energy consumption. But if you require more computing power, Zephyr is the better choice.
Finally, FreeRTOS is from AWS, so it stands to reason that Amazon would make it easy to deploy IoT products in the context of the company’s cloud services, and that is just what AWS has done. So if your devices are processing a lot of data and you need a central cloud platform for storage and processing, FreeRTOS might be the best option because it’s easy to integrate with the AWS cloud ecosystem. But if you want to integrate to another cloud service or your own FreeRTOS might not be such a good choice.
Still, you’ll have to consider the potential security risks, considering AWS’ numerous security breaches in the last few years and the possibility of a malicious actor intercepting communication between the cloud and the client and IoT devices. If your priority is a secure and private connection between a client device and an IoT product, you’ll be better off relying on Zephyr with a P2P communication platform like Nabto.
Nabto and RTOS in IoT
Since it was designed by the Linux Foundation specifically as an open-source, non-commercial RTOS that prioritizes security above all else, Zephyr can easily integrate with Nabto Edge for high throughput, low latency, and secure connectivity. Nabto’s P2P communication allows the device to bypass any cloud intermediary, so all data remains private and stays on the client device.
In conclusion, both Zephyr and FreeRTOS are solid options for IoT with very different features and use cases. It’s up to you which one you choose for your IoT products.
Read Our Other Resources
We’ve also published a range of IoT device resources for our community, including:
- RTOS: Advantages and Disadvantages, which allows you to take a deeper look at the pros and cons of an RTOS compared to an OS.
- How to Choose the Best RTOS for IoT Devices, which gives you a look beyond Zephyr and FreeRTOS to learn more about RTOS options available today.
- P2P IoT Explained, which can help you understand the benefits of P2P for your IoT devices.