Understanding Real-Time Operating Systems (RTOS)

Understanding Real-Time Operating Systems (RTOS)

Understanding Real-Time Operating Systems (RTOS)

Real-Time Operating Systems (RTOS) are operating systems that manage hardware resources, support applications, and handle data in real-time. They define the processing time for real-time tasks, interrupt latency, and the reliability of hardware and applications, which is particularly important for low-power, memory-constrained devices and the networks/systems that rely on them. The key difference between RTOS and general-purpose operating systems is that RTOS provides high reliability and consistency in the timing of task acceptance and completion.

Author Profile: Peng Yu, senior engineer, technical advisor at Shanghai Industrial Automation Instrumentation Research Institute, honorary chairman of PLCopen China, expert in the Ministry of Industry and Information Technology’s intelligent manufacturing standardization working group, and expert consultant for the National Intelligent Manufacturing Standardization Coordination Promotion Group.*This article is authorized to be published by Industrial Control Forum

1

Soft Real-Time, Hard Real-Time

and the Basic Concepts of Determinism

In a document published by Microsoft in 1995 titled “Real-Time Systems and Microsoft Windows NT”, a hard real-time operating system is defined as one that must respond to an event without failure within a specified time interval, with a predictable response that is unaffected by other activities undertaken by the operating system. This shows that hard real-time systems must continuously operate on their data or events within the predetermined time intervals. In contrast, soft real-time systems only operate on their data or events in a timely manner on average, without considering delays caused by deferred procedure calls (DPC) interruptions.

By this definition, it is clear that Windows NT is not a hard real-time operating system. NT cannot guarantee control determinism, and its soft real-time nature makes it difficult to ensure effective execution of control applications. It has the following shortcomings for real-time control: too few thread priorities; opaque and non-deterministic scheduling decisions; potential for priority inversion, especially during interrupt handling, which can leave high-priority tasks waiting.

Introducing the concepts of hard real-time and soft real-time into industrial control systems, the complete expression should be: in a hard real-time system, every event must be responded to, and from the start of the event to the completion of task execution, it must occur within a bounded time period (see the upper part of Figure 1); in a soft real-time system, some events may not trigger task execution and may be lost, and it cannot guarantee that the time required for task execution occurs within a bounded time period (see the lower part of Figure 1). Clearly, without the support of a hard real-time environment, the controller in Figure 1 is in an unstable state, and its control quality is difficult to accept. Therefore, the hard real-time characteristics of the operating system are key factors affecting the determinism of the control system.

Understanding Real-Time Operating Systems (RTOS)

Figure 1 Example of the differences in handling periodic real-time control tasks between hard real-time and soft real-time

The performance of a computer and determinism are not equivalent concepts. The performance of a computer is the ability of a processor to complete effective work. Generally, better performance indicates that more instructions can be processed within a certain time period, and it is usually believed that increasing execution speed (i.e., increasing the processor’s main clock frequency) can improve performance. Event wait time is a measure of a system’s ability to respond to an asynchronous event. The event wait time of a system is closely related to determinism. It is related to the time taken for the CPU to respond to an interrupt and gain control of the bus, as well as the system’s ability to change the CPU’s state to the interrupt handler.
With a clear understanding of the concepts of hard real-time, soft real-time, and control determinism, it can be concluded that: the timing schedule of a hard real-time system is predetermined, so each task is guaranteed to start execution within a precise time limit from the response to external events and to complete program execution within a defined time interval. Therefore, hard real-time systems are deterministic in terms of timing. Soft real-time systems are usually considered based on the average length of time for starting routines, which inevitably results in wait times constrained by other factors, making the execution time of the program difficult to determine. Thus, it can be concluded that applications with strict determinism requirements must choose hard real-time operating systems with deterministic characteristics.
Another way to express this is that time is the key parameter that distinguishes hard real-time from soft real-time. In hard real-time systems, the timeline serves as the criterion that must be followed under any circumstances. Hard real-time systems do not use any type of permanent memory, so their processes must complete correctly on the first execution, meaning they must respond accurately to events within the specified time. This hard predetermined time is generally on the order of milliseconds. Furthermore, hard real-time systems tend to have small or medium-sized data files, so the requirements for data integrity are simpler than for large data files. Examples of hard real-time systems include flight control systems, air traffic control systems, automatic pilot systems, missile guidance systems, anti-missile systems, nuclear reactor control systems, railway signaling systems, electronic medical devices, pacemakers, industrial control systems, and motion control systems.
2

The Necessity of Using Real-Time Operating Systems

Real-Time Operating Systems (RTOS) are the foundation and development platform for a class of embedded/non-embedded application software.During the development phase, RTOS can make the development work easier and more efficient; during the operational phase, it automatically executes software programs, operates on time, and can automatically respond to external events.
From the perspective of more effectively applying software to execute tasks, we have ample reasons to adopt real-time operating systems.Because RTOS provides priority-based scheduling, allowing us to separate non-critical processing tasks from critical processing tasks; RTOS provides API functions that allow us to develop clearer and smaller application code; abstracting designs that require strict timing and are task-based reduces interdependencies between software modules; RTOS provides modular task-based development, facilitating testing of modular tasks; task-based APIs encourage modular development of tasks, typically allowing for clear definitions of functionality within the system, while enabling teams to work independently on their respective parts of the project; RTOS is event-driven and does not waste time on processing triggered by non-occurring events.
Real-time operating systems consist of the following components (see Figure 2): Scheduler determines the order of task execution based on priority; Symmetric Multiprocessing RTOS can handle multiple different tasks in parallel; Function Library users connect to the kernel and application code of the real-time operating system through the function library, allowing users to send requests to the kernel using the function library to obtain the desired results; Memory Management allocates memory space for each program, which is the most important part of RTOS; Fast Scheduling Latency is the interval between the termination of a task recognizable by the operating system and the actual time spent by the thread in the ready queue and has begun processing; User-defined Data Objects and Classes RTOS systems use programming languages such as C and C++, which need to be organized based on their operations.
Understanding Real-Time Operating Systems (RTOS)

Figure 2 Basic Components of Real-Time Operating Systems

The main functions of embedded operating systems, as core system software, are as follows:

① Effectively manage increasingly complex system resources;

② Virtualize hardware, freeing developers from the need to port and maintain drivers;

③ Provide library functions, drivers, toolsets, and applications.

Real-time operating systems generally have the following characteristics: they occupy very little memory, such as the extremely small kernel of VxWorks; consume fewer resources; have strong real-time performance, such as VxWorks’ response to external events ≦1mS; response times to events are highly predictable; can operate in unpredictable environments; the kernel saves the state of interrupted tasks and determines which task should run next; the kernel restores the state of interrupted tasks and hands control back to the CPU. As embedded devices become increasingly powerful and complex, the development of systems increasingly relies on operating systems, to the extent that the operating system becomes an indispensable part of the system.
3

Choosing a Real-Time Operating System

Unlike the limited variety of operating systems available for PCs, there are nearly 200 real-time operating systems available for embedded systems, and the differences between each operating system’s software are subtle and even elusive. We might distinguish the differences between various operating systems based on performance and knowledge regarding scheduling algorithms, signaling characteristics, memory requirements, wait times, tool support, and pricing models.
When specifically choosing a real-time operating system, the following factors can be considered. First is performance, which is the most important factor to consider when selecting an RTOS and should be reasonably considered based on the scenario and scope of use. For example, the maximum number of tasks executed simultaneously—choosing too many wastes resources, while choosing too few may not be sufficient. Middleware, if there is no middleware support in the real-time operating system, then process integration will be time-consuming. It is advisable to select an RTOS system with a good reputation that has been validated through practice to avoid errors during task execution. Generally speaking, embedded systems have limited resources, and the programs of real-time operating systems are small, so using real-time operating systems in embedded systems is the most suitable. Additionally, users prefer real-time operating systems with minimal task switching times, so that real-time performance remains good during task transitions. Unique features: A good RTOS should also have some additional features, such as how to execute commands and effectively protect the system’s memory. 24/7 performance: RTOS is essential for applications that require continuous operation 24 hours a day.
Choosing an RTOS that is just right for embedded products is not an easy task. Currently, commonly used hard real-time operating systems include: WindowsCE (version 6.0/7.0 and above), VxWorks (from Wind River Systems, now acquired by Intel), pSOS, Ventur Com ETS 10.1, Ventur Com RTX 5.1 for Windows NT, 2000, XP, OSE (from Enea in Sweden), etc. For larger applications, Windows NT embedding with a real-time operating system kernel can also be used, referred to as NTe. Additionally, Linux operating systems suitable for embedded systems are publicly available, and there are some real-time Linux operating systems, such as OSADL from the Austrian Open Source Automation Development Lab; for example, integrating another dedicated real-time core Cobalt into the Linux main kernel, and using the PREEMPT_RT patch combined with the Cobalt core, real-time tasks scheduled by Cobalt can be created by periodic Linux tasks.
According to a 2014 market survey of embedded OS, the top eight real-time operating systems are: Green Hills Software’s INTEGRITY, Wind River’s VxWorks, QNX Neutrino, FreeRTOS, Micrium’s µC/OS-II, III, WindowsCE, TI-RTOS Kernel (formerly known as DSP/BIOS), and RTEMS’ open-source RTOS designed for embedded systems, mainly used for missiles and space probes.
4

Overview of Domestic Real-Time Operating Systems

Domestic real-time operating systems include ReWorks, developed by the East China Computer Technology Research Institute based on the introduction and digestion of the American Wind River’s VxWorks real-time operating system, aiming to replace VxWorks in embedded system development. At the same time, all original work results formed on the basis of VxWorks have been ported to ReWorks. The embedded real-time operating system compatible with VxWorks is suitable for various target hardware environments: x86, xScale, PPC, ARM9, etc. It adapts to different system scales: the minimum configuration is less than 100K. ReWorks/ReDe real-time system development and operation platform includes: a development environment that integrates design/development/debugging/simulation, as well as real-time middleware. Figure 3 shows the technical architecture of ReWorks.
Understanding Real-Time Operating Systems (RTOS)

Figure 3 Technical Architecture of ReWorks

A newly rising domestic company, Yihui, has developed an original large hard real-time operating system, SylixOS, which contributes to reducing reliance on foreign embedded operating systems for some critical domestic devices; it also provides a completely new choice for the development of domestic embedded devices. SylixOS supports symmetric multiprocessor platform SMP scheduling, with a kernel autonomy rate of 100% according to the evaluation report from the Ministry of Industry and Information Technology, possessing fully autonomous and controllable technical capabilities.
SylixOS features real-time processes and dynamic loading mechanisms, meeting the needs of multiple developers for distributed software development, and supports the integration of these applications on the operating system; it supports processor architectures such as ARM, MIPS, PowerPC, x86, SPARC, DSP, RISC-V, C-SKY, etc., and supports mainstream domestic general-purpose processors (such as the entire series of Feiteng, Longxin, Zhongtianwei CK810, and the entire series of Zhaoxin), making it easier for users to port applications when upgrading hardware platforms, reducing the workload of porting; SylixOS can be paired with dedicated integrated development environments RealEvo-IDE and hardware simulators RealEvo-Simulator, facilitating system development and debugging, accelerating software development speed, and shortening product development cycles; optimized drivers are provided for different processors to enhance overall system performance.SylixOS complies with IEEE, ISO, IEC-related operating system programming interface specifications, allowing users’ existing applications to migrate easily to SylixOS.
SylixOS is an open-source operating system, and to ensure its continuous development and attract a large number of developers to participate in testing, it currently exists as an open-source code project.
5

Real-Time Operating Systems Used in the Industrial Internet

Embedded systems, real-time operating systems, and the Internet of Things are strongly related, as real-time operating system solutions are a fundamental component for constructing embedded systems for consumer products and industrial Internet of Things (IIoT) asset devices, systems, and processes. Thus, embedded real-time operating systems are core factors in deploying mission-critical, ultra-reliable industrial IoT applications across various industries (including industrial equipment, automotive, healthcare, telecommunications, government solutions, etc.). This is especially true in industrial automation processes and manufacturing devices and equipment like smart machines and robots. According to a report released by Global Market Insights in September 2019, the increasing popularity of real-time operating systems (RTOS) in IoT applications is one of the driving factors for expected growth in the industry. More specifically, the market value exceeded $12 billion in 2019. The research company expects an annual growth rate of over 6% from 2019 to 2025. Analysts from Global Market Insights also confirm that advanced real-time operating system options allow developers to build smaller IoT devices without compromising performance or safety.

Real-time operating systems existed long before IoT devices appeared, so feasibility studies for real-time operating systems for IoT applications began as early as 2016, with some common misconceptions emerging, such as that IoT electronic products do not require real-time operating frameworks, or that polling loop architectures could also meet the requirements. However, it quickly moved away from these traps, and many companies now provide real-time operating systems for IoT devices, with some teams collaborating to improve existing real-time operating systems.

For example, the Zephyr project, hosted by the Linux Foundation, is building a real-time operating system for IoT tools; it is an open-source, community-driven effort focused on innovation. Additionally, Wind River also has a product called VxWorks, which is another real-time operating system for IoT. IntervalZero is another provider offering real-time frameworks designed for IoT. Amazon has a real-time operating system brand, Amazon FreeRTOS. Microsoft also acquired Express Logic in 2019, which developed an industrial-grade ThreadX real-time operating system. It later evolved into the Azure RTOS embedded development suite, including Azure RTOS ThreadX, FileX, GUIX Studio and GUIX, TraceX, NetX, NetX Duo, USBX. This is a small but powerful operating system that provides reliable, ultra-fast performance for resource-constrained devices. It is easy to use and market-validated, having been deployed in over 10 billion devices worldwide. Azure RTOS supports the most popular 32-bit microcontrollers and embedded development tools. Azure RTOS has achieved IEC61508 SIL4 functional safety certification and has been applied in safety-critical products in fields such as avionics, medical devices, transportation, and industrial control equipment. Huawei’s LightOS is also a very good real-time operating system for IoT (see Figure 4), LightOS can also be used for 5G networks. The absence of 5G in this figure is due to the earlier drawing.

Understanding Real-Time Operating Systems (RTOS)

Figure 4 Huawei’s IoT Real-Time Operating System LightOS

As people begin to explore how real-time operating systems can empower the IoT, opportunities arise to collect or use data in new ways.This outcome benefits the entire IoT industry, not just the machines and devices using real-time operating systems. When choosing a company to provide real-time operating systems for IoT devices, it is often desirable to understand which real-time operating systems can enhance their performance in developing IoT designs, as real-time operating systems play a vital role in the functionality of connected devices and the capabilities of the systems. Among these, information security and functional safety issues must be prioritized.

For instance, in July 2019, Wind River announced 11 vulnerabilities related to the VxWorks real-time operating system; although they released a patch to fix it, the unsettling fact is that around 200 million devices were running this flawed version of the operating system when the vulnerabilities were discovered. Another Micro-Electro-Mechanical Systems (MEMS) are key components in various embedded devices, systems, solutions, and applications across almost all vertical industries.It is a tiny integrated device or system that combines mechanical and electrical components, consisting of a central unit (microprocessor) that processes data and several parts that interact with the surrounding environment (such as micro-sensors). By perceiving, controlling, and driving at a micro scale and impacting at a macro scale, MEMS provide benefits for enterprises using IoT. The real-time operating systems suitable for MEMS applications should also be a consideration.

As people begin to explore how real-time operating systems can empower the IoT, opportunities arise to collect or use data in new ways. This outcome benefits the entire IoT industry, not just the machines and devices using real-time operating systems. When choosing a company to provide real-time operating systems for IoT devices, it is often desirable to understand which real-time operating systems can enhance their performance in developing IoT designs, as real-time operating systems play a vital role in the functionality of connected devices and the capabilities of the systems. Among these, information security and functional safety issues must be prioritized. For instance, in July 2019, Wind River announced 11 vulnerabilities related to the VxWorks real-time operating system, although they released a patch to fix it, the unsettling fact is that around 200 million devices were running this flawed version of the operating system when the vulnerabilities were discovered. Additionally, Micro-Electro-Mechanical Systems (MEMS) are key components in various embedded devices, systems, solutions, and applications across almost all vertical industries.

6

Security Issues of Real-Time Operating Systems

As a foundational software, real-time operating systems should also comply with certain software security guarantees. There are various standards for software security certification.Information security standards: The common standard for information technology security assessment is the international standard ISO/IEC15408, which is established for security performance, security assurance, and security assessment. This standard has been recognized by the US government, Canada, and 23 other countries. It divides Evaluation Assurance Levels (EAL) into seven levels. Currently, the highest level of operating systems assessed is EAL6+ (the Integrity-178B real-time operating system from Green Hills Software). Functional safety standards: The industrial software functional safety standard IEC61508-3 divides safety integrity levels (SIL) into four levels (see Table 1). As far as I know, the highest level of operating systems assessed is SIL3 (from Integrity, VxWorks, Canada QNX, etc.). Microsoft claims that its Azure RTOS has obtained IEC61508 SIL 4 functional safety certification but does not specify which organization certified it.

Understanding Real-Time Operating Systems (RTOS)

Currently, many real-time operating systems adopt partitioning technology, which places different software parts in protected address spaces, so that when a certain part of the program fails or is compromised, it does not affect the entire system. Green Hills Software’s INTEGRITY real-time operating system has adopted the concept of a separated kernel for 10 years. Figure 5 illustrates the partitioning concept of the INTEGRITY real-time operating system. Its integrated development environment is shown in Figure 6, including Green Hills’ optimized compiler, advanced analysis tools, and target connection.

Understanding Real-Time Operating Systems (RTOS)

Figure 5 Partitioning Concept of the INTEGRITY Real-Time Operating System

Understanding Real-Time Operating Systems (RTOS)

Figure 6 Integrated Development Environment from Green Hills Software

Partitioned kernel architecture is currently recognized as the only correct method for designing software.It can be used in: ① Many applications requiring guaranteed CPU time and memory; ② Safely connecting any device in a simple manner. Operating systems that also adopt partitioning technology can be divided into: single-kernel partitioning technology and multi-kernel partitioning technology.

The security issues of open-source embedded operating systems. Since μCOSⅡ is an open-source real-time operating system, it is widely used domestically.There is no material available regarding the security certification of μCOSⅡ, so it is impossible to comment overall. The only feasible method is for whoever adopts a tailored μCOSⅡ in embedded systems according to their needs, to conduct a self-assessment based on the IEC61508-3 V&V method when SIL level certification is needed, and then find a qualified third party for V&V certification.

The International Intelligent Manufacturing Forum will be held in Hangzhou

July 30– Long press the QR code to register
Manufacturing enterprises3 freeplaces
Seize this rare opportunity for learning and communication
Understanding Real-Time Operating Systems (RTOS)

▼Click “Read Original” 【Quick Online Registration】

Leave a Comment

×