This page was machine-translated and may differ from the original. View original

[Series] ST Engineer Yuji Kawano ⑬ – “RTOS Processing Completed Within Specified Time Range”

Google 우선 소스Published2022.02.15 12:08
“RTOS processing completed within the specified time range”
Process tasks according to preset priorities
Various functions are needed in addition to real-time processing performance.

[Editor's Note] Generally, when people think of semiconductors, they tend to picture components familiar to the general public, such as computer CPUs and memory. On the other hand, the Micro Controller Unit (MCU), which serves as a core semiconductor for driving electronic products, is used in virtually every electronic device we encounter, yet remains an unfamiliar semiconductor to the general public. Recently, however, MCUs have begun to attract public attention as they have been frequently mentioned in the media due to the semiconductor shortage. Accordingly, this publication has organized a series of articles by Manager Yuji Kawano of STMicroelectronics, a company specializing in MCU semiconductors, to provide a professional look into MCUs.



Now you can see how important it is to choose the right MCU software for your purpose and environment. Today, I would like to talk a little more about operating systems. This will help you deepen your understanding of the role and functions of the OS.

In the last 10th episode, we explained that the OS is a type of software installed to improve the versatility of application software and middleware. Fundamentally, the OS eliminates the system's device dependency by abstracting the hardware.

What comes to mind first when you hear the word "OS"? Like most people, you will likely think of Windows. This popular OS is installed on many PCs, including home computers, and is widely known through TV commercials. You might also think of Android or iOS, which support the smartphones and tablet PCs that are gaining popularity these days. Engineers working with embedded software would probably think of many other OSs, such as Linux, ITRON, Symbian, T-kernel, and VxWorks.

The various available operating systems can be broadly classified into two types: universal operating systems and real-time operating systems (RTOS).

Although the difference between a general-purpose OS and a real-time OS is explained below, we must first consider what 'real-time' means.

■ Meaning of 'Real-time'

Let's look at the following example to help us better understand real-time functions. Assume we have a real-time computer and a non-real-time computer, and that both perform the same operation. Consequently, we will obtain the same result, but what is the difference? The difference is that for a non-real-time computer, the task is considered successfully completed based on obtaining an accurate result, whereas this is not the case for a real-time computer. In addition to generating an accurate result, a real-time computer must complete the calculation within a time limit. In this example, since the time limit is 1 minute, the real-time computer must complete the calculation within 1 minute to consider the task successfully completed.

Therefore, a computer considered to be a real-time computer must have a time limit specified and must satisfy it (see Figure 1).

Based on this explanation, it can be seen that general-purpose OSs are not subject to strict processing times, whereas RTOSs must complete processing within a specified time range.


▲Figure 1: Real-time processing



■ Characteristics of a General-Purpose OS

Generally, general-purpose operating systems use a time-sharing method when performing multiple tasks in parallel. In this method, if a new task request occurs and the OS is already performing another task, it does not begin processing the new task until a specified time has elapsed (see Figure 2). Under this time-sharing method, also known as round-robin, the OS switches from one task to another only at specific times.

Many PC operating systems, such as Windows and Linux, are general-purpose operating systems.


▲Figure 2: General-purpose and real-time OS


■ RTOS Features

To process multiple tasks in parallel, an RTOS must process tasks according to preset priorities rather than the time-sharing method of a general-purpose OS. This allows the system to complete each task within a specified time limit. As shown in Figure 2, a general-purpose OS and an RTOS can complete the same three tasks in different orders. The RTOS completes the task with the higher priority before completing other tasks.

For MCUs, an RTOS is generally selected. Typical examples of RTOS include uCOS-II and embOS, which are installed in various products of STMicroelectronics' 32-bit MCU, the STM32 series. An RTOS installed on an MCU that provides built-in flash memory must support a small OS footprint (i.e., small capacity ROM and RAM).

■ Required functions of RTOS

As you know, the most important aspect of an RTOS is real-time processing performance, but in practice, the following features are also necessary.

▷ Parallel processing function
Figure 2 illustrates how three tasks are processed by an RTOS. To process these three tasks in parallel and simultaneously, the OS must determine the state of each task and perform task switching and task scheduling accordingly. The RTOS function for performing this process is called the parallel processing function (or task control function). Various task states include executing, resting, ready, and waiting.

▷Synchronization function
Synchronization functions synchronize different tasks with interrelated processing times, such as when one task must be completed before another task begins processing. Synchronization methods include semaphores and event flags.

▷ Communication function
Communication functions are somewhat similar to synchronization functions, but they exchange not only processing time information but also task data related to specific tasks, such as when data processed in one task is used in the next. Communication methods include data queues and mailboxes.

▷ Time control function
RTOS uses time control functions to perform time-related operations such as suspending tasks and periodic task invocation. This function not only sets and references the system clock but also performs delayed task processing, time-out processing, etc.

▷ Interrupt control function
When an interrupt occurs between tasks, the RTOS must temporarily suspend the processing of the current task and switch to the process corresponding to the interrupt. In such cases, interrupt control functions control the execution interrupt handler and path. These processes include defining the interrupt handler, creating and removing the interrupt path, referencing the interrupt path status, enabling and disabling interrupts, and interrupt masking.

▷ Memory control function
Since memory is a limited resource, this feature dynamically manages the memory usage of each task. Control methods include fixed-length memory pools and variable-length memory pools.

Various operating systems can be classified as RTOS or general-purpose OS. Generally, RTOS are installed on MCUs that require a small OS footprint. Additionally, RTOS must provide specific basic functions used to configure the necessary application software.
본 기사에 대한 정정·반론·추후보도 청구는 보도 청구 안내를, 그간 게재된 보도문은 정정·반론보도 모아보기를 참고해 주세요.
명세환 기자
명세환 기자