HarmonyOS: A Real-Time IoT Operating System

HarmonyOS: A Real-Time IoT Operating System

This is a platform for knowledge sharing and dissemination. Patience in reading to the end will yield surprises and gains.

Real-time operating systems are not as simple as “real-time” suggests

By | Bu Rixin

Key point summary: During the recent US-China trade war, the US mobilized national strength to deal with Huawei, with the core strategy targeting China’s “core high-tech” strategy. Recently, Ren Zhengfei stated in an exclusive interview that the Harmony operating system is not meant for mobile phones, but for the Internet of Things, such as autonomous driving and industrial automation.

From this, it can be inferred that Harmony is an IoT operating system, which is a type of real-time operating system. The “real-time” in a real-time operating system does not emphasize the speed of response but rather the certainty of response. That is, certain tasks can complete responses within a predictable time, which is known as determinism.

HarmonyOS: A Real-Time IoT Operating System

Regarding operating systems, I believe everyone is both familiar and unfamiliar.

Familiar because operating systems are essential for controlling all electronic devices; unfamiliar because there are many types of operating systems, and what we know may be limited to commonly used ones like Microsoft’s Windows and Google’s Android.

The reason for discussing operating systems stems from Ren Zhengfei’s recent statement in an interview with the Financial Times, indicating that (Huawei’s) Harmony operating system is not meant for mobile phones but for the Internet of Things, such as autonomous driving and industrial automation, as it can precisely control latency below five milliseconds, even reaching millisecond to sub-millisecond levels.

During this US-China trade war, the US mobilized national strength to deal with Huawei, targeting China’s core high-tech strategy. “Core high-tech” refers to core electronic components, high-end general-purpose chips, and foundational software products, which have traditionally been strong areas for the US.

As one of the core areas of “core high-tech”, foundational software products, among which operating systems are the most important foundational software. Mainstream operating systems like Microsoft’s Windows, Google’s Android, Apple’s Mac OS, even Unix and various open-source distributions like Redhat… are all rooted in the US.

The absence of mainstream domestic operating systems has long been a source of regret for many. Huawei’s emergence in the context of the US-China trade war, taking up the banner of an independent operating system, has been seen by many as an inspiring move.

However, operating systems are not just a technical issue but also an ecological issue.

Huawei’s self-developed Harmony operating system has not yet surfaced, leaving much room for imagination. But at the same time, building a complete ecosystem around a brand new operating system is no easy task. Ren Zhengfei’s statement has bypassed the pitfalls of a general-purpose operating system, defining the “Harmony” operating system as an IoT operating system, which is relatively easier to build an ecosystem in the industrial and IoT fields.

Huawei previously had an IoT operating system, LiteOS, launched in 2015, which supported various products including Huawei smartphones, wearable devices, and IoT chips.

Since IoT operating systems are lightweight and the application fields are relatively closed, many manufacturers have developed their own IoT operating systems both domestically and internationally. For instance, Alibaba’s AliOS Things, Google’s Android Things, ARM’s Mbed OS, and more. This also includes some IoT startups that develop API-friendly operating systems for different IoT application scenarios, such as Mosi Technology’s MP-OS and Titanium Cloud’s Titanium OS.

Ren Zhengfei mentioned that Huawei’s operating system reacts quickly, “reaching millisecond to sub-millisecond levels”, further confirming that “Harmony” is an IoT operating system, a type of real-time operating system (RTOS).

What is a real-time operating system? The name sounds quite “magical” and attractive. If an operating system can achieve real-time performance, without stuttering, delays, or crashes, and does not require garbage cleaning, how appealing and desirable would that be?

Before discussing real-time operating systems, let’s take a look at how many types of operating systems exist. As mentioned earlier, operating systems are essential for controlling all electronic devices, meaning there are as many types of operating systems as there are electronic products.

For example, we are somewhat aware of MacOS, Windows, UNIX, Android, iOS, various commercial operating systems developed based on open-source Linux, embedded operating systems… and the various closed-domain IoT operating systems mentioned earlier…

From a classification perspective, operating systems mainly include: batch processing operating systems, general-purpose operating systems, time-sharing operating systems, real-time operating systems, network operating systems, distributed operating systems, embedded operating systems, cloud computing operating systems…

Of course, the above classifications are somewhat chaotic; for instance, batch processing operating systems, time-sharing operating systems, and real-time operating systems belong to one dimension, categorized based on scheduling of computational resources and task execution; general-purpose operating systems and embedded operating systems belong to another dimension, categorized by device generality and specialization; network operating systems, distributed operating systems, and cloud computing operating systems form yet another dimension based on computational power…

The focus of this article is on real-time operating systems, and the reality may disappoint you; it actually emphasizes not real-time performance. We know that the response speed of an electronic device is most related to its computational power. But computational power is limited, and the CPU cannot operate beyond its capacity, while program demand for load is infinite, which is also a primary reason for computers frequently crashing.

I’m sure everyone has experienced this while using Windows, especially when transferring large files or downloading, trying to perform other operations at the same time, which often leads to resource congestion, causing the computer to slow down or even crash.

Given the CPU’s computational power bottleneck, it is evident that an idealized operating system cannot allow programs to execute in a “real-time” manner under concurrent conditions.

Thus, the “real-time” in real-time operating systems does not emphasize the speed of response but rather the certainty of response. That is, certain tasks can complete responses within a predictable time, which is referred to as determinism.

Determinism is crucial in some fields, such as industrial, autonomous driving, and certain IoT areas. Imagine a car’s control system; if an accident occurs, where lives are at stake, the system must prioritize the rapid execution of airbag deployment without delay and certainly cannot crash at a critical moment.

The essential difference between real-time operating systems and time-sharing operating systems lies in how they schedule different programs, tasks, processes, and threads on a limited CPU.

Time-sharing operating systems employ a relatively fair strategy, using time-slicing, dividing CPU runtime into very short time slices, and allocating these slices to different processes in turn.

In contrast, real-time operating systems adopt a priority strategy, meaning preemptive scheduling, where different processes are assigned different priorities. When a high-priority process appears, the computer can interrupt the currently running process and allocate CPU usage to the higher priority process that is ready to run.

Thus, priority-based real-time operating systems only differ in CPU scheduling methods, but the priority among various processes also needs to be scientifically designed. If priorities become chaotic, poor CPU scheduling can lead to severe consequences such as system crashes or hangs.

Of course, it doesn’t mean that IoT operating systems must be preemptive real-time operating systems. In resource scheduling, preemptive scheduling ensures that high-priority processes run first at any moment, interrupting ongoing processes. To achieve this, it is necessary to increase the scheduling of processors, preserving the context of interrupted processes while allocating new space for new processes, increasing system operational overhead, sacrificing efficiency and power consumption.

Therefore, whether or not it is real-time is not crucial; the IoT application field is a vast ocean of stars, what is suitable is the best.

HarmonyOS: A Real-Time IoT Operating System

HarmonyOS: A Real-Time IoT Operating System

Thank you for reading to the end,

Feel free to share and spread~

HarmonyOS: A Real-Time IoT Operating System

Leave a Comment