What is a real-time operating system (RTOS)? (original) (raw)
By
- Nick Barney,
- Alexander S. Gillis, Technical Writer and Editor
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:
- Air traffic control systems.
- Anti-lock brakes and air bags.
- Cameras.
- Medical systems.
- PCs.
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:
- Multitasking, where tasks are rapidly switched back and forth to give the impression that multiple programs are executing concurrently.
- Process thread prioritization.
- A sufficient number of interrupt levels.
RTOSes generally have the following characteristics:
- Small footprint. Compared to general OSes, real-time operating systems are lightweight.
- High performance. RTOSes are typically fast and responsive.
- Determinism. Repeating inputs end in the same output.
- Safety and security. Safety-critical and security standards are typically the highest priority, as RTOSes are frequently used in critical systems.
- Priority-based scheduling. Tasks that are assigned a high priority are executed first followed by lower-priority tasks.
- Timing information. RTOSes are responsible for timing and providing application programming interfaces.
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.
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:
- Hard RTOSes. Operating under strict timing requirements, hard RTOSes make strong assumptions about the application, system and environment being static and known in advance. These systems provide deterministic guarantees, ensuring all tasks meet their deadlines and system calls respond within specified time limits. An example of a hard RTOS is a satellite-based tracking system such as a global positioning system.
- Firm RTOSes. Tasks with these systems have time bounds but are more flexible than hard RTOSes. Results must be produced within deadlines, but system failure doesn't occur if deadlines are missed. Firm RTOSes are commonly used in multimedia applications. For instance, a hearing aid system that occasionally produces noise pulses because of late data processing is considered a firm RTOS.
- Soft RTOSes. These tasks have time constraints, but they're expressed as average values rather than absolute deadlines. Results obtained after deadlines aren't considered incorrect and system utility gradually decreases. A soft RTOS is used in practical applications such as railway ticket reservations. It provides the best timelines under dynamic circumstances.
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:
- Resource use. RTOSes can maximize resource use while keeping devices active, resulting in minimal downtime. This feature makes RTOS particularly suitable for applications that need optimal performance.
- Task management. RTOSes can switch tasks rapidly, often in three microseconds or less. This task shifting ensures critical processes are completed on time, enhancing overall system efficiency. The focus on running the most important queued tasks and critical applications can further contribute to their effectiveness.
- Error free. RTOSes are well-suited for error handling and can be optimized for few jitters. This reliability is crucial for applications that require continuous operation because RTOSes are accessible 24/7 and support various MCU platforms.
Disadvantages of RTOS
RTOSes come with certain drawbacks, including the following:
- Poor multitasking. RTOSes are designed to run only a few tasks and stay focused on them, making them unsuitable for systems requiring extensive multitasking.
- Complexity. RTOSes rely on intricate algorithms that are difficult for average users to write or understand. Only expert developers can effectively work with these complex algorithms.
- Limited task handling. To maintain accuracy and reduce errors, RTOSes focus on one application at a time, leaving low-priority tasks on standby indefinitely. This can lead to inefficient resource allocation and potential delays in noncritical processes.
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.
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:
- Medical devices. RTOSes are used in various medical devices, such as infusion pumps, respiratory equipment, patient monitoring systems and internet of medical things. They ensure reliable and accurate drug delivery in infusion pumps and enable fine-tuning of oxygen levels in respiratory devices. The fault-tolerant nature of an RTOS is crucial in medical settings where system failures can have negative consequences for patient safety.
- Defense systems. RTOSes play a critical role in defense applications. They're used in avionics systems, satellite operations and unmanned aerial vehicles. Their use in these systems ensures predictable behavior, which is essential for military missions. In missile and radar systems, RTOSes coordinate complex targeting and defense mechanisms.
- Air traffic control. RTOSes are vital in air traffic control systems, where precise timing and synchronization are critical. These systems require real-time processing of large amounts of data, which RTOSes handle efficiently. The ability of these systems to meet tight processing deadlines, often measured in millionths of a second, is crucial for flight control functions.
- Industrial automation. In industrial automation, RTOSes are used for programmable logic controllers, robotics controllers and supervisory control and data acquisition systems. An RTOS allows for precise control and timing of industrial operations, increasing productivity. These systems are positioned to be a key component of Industry 4.0, revolutionizing manufacturing through networked machines and real-time decision-making.
Factors to consider when choosing an RTOS
When looking for a real-time operating system, the following factors should be considered:
- Responsiveness. Factors that determine responsiveness include the scheduling algorithm, interrupt latency and context switch times.
- Safety certifications. Precertified and certified RTOSes ensure the quality of the RTOS meets industry design standards.
- Available system resources. The architecture defines the type of system resources needed. For example, microkernels use a small amount of system resources.
- Security. There are free, open source RTOSes available, such as FreeRTOS from Amazon Web Services and RT-Thread, as well as commercial options, such as BlackBerry's QNX Neutrino, Wind River Systems' VxWorks and Wittenstein's SafeRTOS. Both open source and commercial products provide built-in security features, but some offerings are more extensive.
- Compatibility. Long-term use must be factored in. The potential for future support and updates should be considered if an organization is going to use the RTOS for an extended period.
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)?
- Edge platforms to consider for a hybrid cloud enterprise
- Select the right OS for IoT devices
- Testing IoT devices helps ensure deployment success
- Key considerations for setting up an IoMT network
- Embedded system terms IoT admins must know