What is a real-time operating system (RTOS)? (original) (raw)

By

A real-time operating system (RTOS) is an OS that guarantees real-time applications a certain capability within a specified deadline. RTOSes are designed for critical systems and for devices like microcontrollers (MCUs) that are timing-specific. The processing time requirements of an RTOS are measured in milliseconds. Any delays in responding could have disastrous consequences.

Real-time operating systems have functions similar to general-purpose OSes (GPOSes), such as Linux, Microsoft Windows and macOS. However, they're designed so that a scheduler in the OS can meet specific deadlines for different tasks.

RTOSes commonly appear in embedded systems that are used in mobile, network and real-time applications. Those systems are a combination of hardware and software designed for a specific function and can also operate within a larger system. Embedded systems often are used in real-time environments that use RTOSes to communicate with the hardware.

RTOSes are designed to handle multiple processes at one time, ensuring that these processes respond to events within a predictable time limit. Processing in an RTOS occurs within defined time constraints. The priority of tasks is monitored and the system can change task priority. Systems that are event-driven often switch between tasks based on priority.

RTOSes are included in the following devices:

Characteristics of a real-time operating system

Some RTOSes are created for special applications, while others are general-purpose. However, they typically provide the following functionality:

RTOSes generally have the following characteristics:

How does an RTOS work?

RTOSes are subdivided into soft and hard real-time systems. A soft RTOS is designed to operate within a few hundred milliseconds, while a hard RTOS is designed to provide predictable response times within tens of milliseconds.

Soft real-time systems typically have larger file sizes compared to hard ones. Some executions act less predictably during peak load but are tolerated, as computations are rolled back to previously established checkpoints if an error occurs. Soft RTOSes are normally used in systems where time-based executions are less important, such as in PCs, cameras and smartphones.

Hard RTOSes typically have small or medium-sized data files. They act predictably during moments of peak loads, and computation is rolled back if an error occurs. Hard RTOSes are normally used in systems that require important time-based executions, such as in airplane sensors, autopilot systems and medical devices.

In hard real-time OSes, if the calculation can't be performed to make an object available at the designated time, the OS terminates with a failure. In a soft RTOS, the OS continues to function, but certain tasks might be unproductive if they fail to execute at a given time.

RTOSes also act as a scheduler, scheduling tasks as ready to run, running or blocked.

Diagram of a kernel layout.

A kernel interacts with the rest of the operating system, including the application layer and the device layer, and with components such as the CPU and memory.

They typically have a monolithic kernel and microkernel architecture. The OS kernel is the core of the operating system that provides basic services for all other parts of the OS. Kernels are the main layer between the OS and hardware; they keep user applications from interfering with critical system functions.

Monolithic RTOS kernel and operation processes share one space. This architecture operates quickly when compared to microkernel configurations and typically provides better performance. Even though monolithic RTOSes run faster, they're harder to perform updates on, and a programming error in the file system, protocol stack or driver can cause system crashes.

The microkernel architecture houses the kernel and operations in separate locations. This architecture is slower than monolithic RTOS, as any action must return to the kernel before it can move to the component it references. The microkernel also lacks a file system.

Types of real-time operating systems

RTOSes are classified into three main categories based on their time constraints and consequences of missing deadlines:

Advantages of RTOSes

A real-time operating system offers several benefits that make them ideal for critical tasks and applications. The following are the most significant advantages:

Disadvantages of RTOS

RTOSes come with certain drawbacks, including the following:

RTOS vs. GPOS

General-purpose OSes, like Windows and Unix, can handle multiple tasks concurrently. However, they aren't ideal for important, time-sensitive applications because of latency and synchronization issues. GPOSes also operate without time constraints, so tasks sometimes fail or take longer to execute. In other words, they provide a potential nondeterministic, soft real-time response to tasks.

RTOSes typically provide a deterministic, hard, real-time response with the goal of providing a quick reaction to events. While GPOSes are good for general consumer use, RTOSes are designed for instances where a system must respond to an event or task within a short, designated time frame. RTOSes need to be quick and accurate for the typically embedded systems they reside in.

Diagram of an embedded system architecture.

Embedded system architecture is comprised of sensors, actuators, memory and other components.

RTOS use cases

RTOSes have important applications across various industries. Some of the most important include the following:

Factors to consider when choosing an RTOS

When looking for a real-time operating system, the following factors should be considered:

Embedded systems and RTOSes are important parts of IoT device functionality. Learn how they all work together.

This was last updated in October 2024

Continue Reading About What is a real-time operating system (RTOS)?

Dig Deeper on Data center ops, monitoring and management