
This article will explore the system characteristics we should consider when choosing an operating system. Then, in the next article, we will discuss when it is most suitable to use each type of operating system.
Embedded system developers today can choose from a wide range of operating systems. Of course, the most straightforward operating system is no operating system at all! However, many of today’s systems are complex connected systems, and therefore may require an operating system. When needed, developers often seek to use a Real-Time Operating System (RTOS) or Linux to help manage complexity. Unfortunately, how to choose between bare metal, RTOS, or Linux is not always clear. Each option has its pros and cons.
This article will explore the system characteristics we should consider when choosing an operating system. Then, in the next article, we will discuss when it is most suitable to use each type of operating system.
Lifecycle Cost of the Product
When selecting an operating system for embedded systems, we first need to understand the lifecycle costs and requirements of our product. We need to balance the Bill of Materials (BOM) costs and software maintenance costs. For example, embedded systems using Linux can more easily leverage open-source software and find developers who can write system software. However, Linux-based systems have more complex hardware requirements than microcontroller (MCU)-based systems and may have higher BOM costs. MCU-based systems may cost less, but there are also fewer developers capable of successfully designing and maintaining these systems.
Designers need to weigh hardware and software costs to determine whether their product is suited for hardware that can run Linux or whether it is better suited for cheaper, less CPU-intensive solutions.
Physical Characteristics to Consider
When it comes to hardware functionality and requirements, examining the physical characteristics of the hardware choices is also essential when selecting an embedded operating system. The physical factors of the microprocessor (MPU) or MCU to consider include:
The physical limitations imposed by hardware may immediately restrict which options can be used. For example, running embedded Linux typically requires a processor with a Memory Management Unit (MMU). Unfortunately, MCUs do not have an MMU. Therefore, to run Linux, designers need to use at least an application processor from the Cortex-A range, not an MCU from the Cortex-M series (though this is changing rapidly, and someone may get an MCU with an MMU and reasonable clock rates).
To run embedded Linux, the hardware must also have at least 8GB of storage, 16GB of RAM, and 8-16MB of internal flash storage. A kernel like Linux may also require a processor of at least 500MHz. These requirements are significantly higher than those needed to run an RTOS, which requires at least 4kB of RAM, 64kB of flash, and a CPU running at 24MHz.
Real-Time Performance
From experience, I have learned that exploring the real-time performance characteristics between bare metal, RTOS, and Linux systems is a hot potato. Engineers focused on MCU-based real-time systems often tell us that users cannot achieve true real-time performance from Linux systems. Linux engineers will counter that this is not true—Linux has real-time patches that can provide actual real-time behavior. Since then, the debate often becomes heated.
Regardless of where we stand, we must look at real-time requirements and utilize them when choosing an operating system. Assess the determinism required by the system and evaluate your operating system based on those needs. I have seen well-running real-time versions of Linux, and others that did not perform well. Therefore, there is no universally correct answer, only the answer that fits your application.
Software Library Integration
One significant difference between using bare metal, RTOS, or Linux is the availability and integration of software libraries for developers. In the bare metal space, you have to rely on yourself, either writing software from scratch or integrating third-party libraries yourself. On the other hand, RTOS often comes with a set of libraries that are already integrated with the RTOS. For instance, you may find circular buffers, memory management tools, and file systems, among others. More libraries are available and implemented, but you may still need to do some work yourself.
When we look at Linux, it feels like developers have almost unlimited libraries available that are already integrated with the system. The most attractive and value-added feature of embedded Linux is the availability and integration of software libraries. Developers can use a comprehensive operating system that is powerful but also potentially dangerous.
Don’t Forget Security
Today, many designers are building connected systems that must have secure solutions. The operating system plays a significant role in security solutions. For example, if a vulnerability is found in the standard libraries used in the Linux kernel, every Linux device has that vulnerability until it is patched. Bare metal or RTOS-based systems are less likely to have the same vulnerabilities. Certain operating systems are more likely than others to become targets for hackers because they can use toolsets to break into these devices. For instance, I have put embedded systems using RTOS directly on the Internet without any protections, and they have been running for weeks without being compromised. However, I once put a Linux-based system on the Internet, and it was hacked within 48 hours and became part of a botnet in China. In the Linux system defense, I believe the default password was still set, but this shows that if we do not take the time to configure the operating system correctly, it does not take much time to crack it.
Conclusion
Developers should consider many characteristics when choosing an operating system. The first characteristic is more about cost and the business aspects of building a product. However, more critical characteristics, such as available libraries, security, and maintainability, also play a crucial role. So, which operating system should we use, and when should we use it? In the next article, we will explore this issue and provide guidance on where to use bare metal, RTOS, and Linux.
Author:Jacob Beningo, Source: EDN sister site Embedded
Reference Original: How to select your embedded systems operating system: OS characteristics, compiled by Franklin Zhao.
Copyright Statement: This article is from the September 2022 issue of “Electronic Technology Design” magazine, all rights reserved, and reproduction is prohibited without authorization.
♥Click 👇 the business card, follow me♥
1. Classic MOSFET Level Shifting Circuit, a must-have remedy for hardware engineers during home travel and guarding the gate!
2. About LDO and DC-DC, this one is enough!
3. What is capacitor bulging? Does it need to be replaced?