What Is a Real-Time Operating System (RTOS)?

Ask Bill Anything About RTOS

ASK BILL QUESTION









The information you submit is kept private and confidential.

Bill Lamie

Bill has been in the commercial RTOS space for over 30 years - first with Accelerated Technology (acquired by Siemens) and then with Express Logic (acquired by Microsoft). Bill was the sole author of Nucleus and ThreadX. Bill’s latest creation is the PX5 RTOS!

Message Sent

Thank you for contacting!
Bill will get back to you as soon as possible.

What Is an RTOS?

A Real-Time Operating System (RTOS) is a software platform for real-time computing applications that process events and data within well-defined time constraints. Typically, a real-time OS responds to inputs in microseconds. Computing devices with less than 1 MB of memory need specific features in a tiny operating system called an RTOS.

In this section, you’ll learn about what an RTOS does, what makes an RTOS different from other operating systems, three RTOS types, and two RTOS architectures.

What an RTOS OS does

An RTOS operating system manages processor cycles, memory, peripherals, and interrupts. Embedded developers use an RTOS when an application’s real-time requirements or memory constraints make unsuitable a general purpose operating system, like Linux or Windows.

Difference between an RTOS and other OS?

Determinism, small footprint, quick response, concurrent jobs, safety, and security are key aspects of an RTOS.

  • Determinism: An RTOS is deterministic, which means a given input always results in the same output—and often follows the same control path through code.
  • Minimal footprint: An RTOS operates on resource-constrained platforms, so it must be able to be installed and run in a small memory footprint.
  • Minimal latency: An RTOS responds quickly to external events, often executing tasks in less than a second.
  • Concurrency: An RTOS executes multiple jobs simultaneously, so it uses resource schedulers to avoid conflicts.
  • Safety and security: Some real-time operating systems include functional safety and cybersecurity features. They may even be pre-certified to demonstrate support for industry best practices.

RTOS Types

RTOS come in three types based on levels of responsiveness: hard, firm, and soft.

  • A hard RTOS is used in systems that have strict timing requirements, where tasks must be completed in a guaranteed timeframe to ensure proper functioning. Ideal for automotive cruise control and railway signaling systems.
  • A firm RTOS is used in systems with a mix of tasks, some of which have deadlines that must be met while others can tolerate occasional misses. Ideal for robotic assembly lines and telecommunications networks.
  • A soft RTOS is used in systems that have flexibility in meeting task deadlines, such as in-flight entertainment and voice chat apps.

RTOS Architectures

Two categories of RTOS architectures are monolithic kernel and microkernel.

  • A monolithic kernel RTOS puts all OS components and operating processes in the same memory space, which makes it faster.
  • A microkernel RTOS keeps core functions separate from application-specific functions, which makes it more modular, fault tolerant, and cybersecure.
RTOS

RTOS in Embedded Systems

An embedded RTOS runs applications, enables them to interoperate in the device, and communicate with the world.

In this section, you’ll learn about seven popular RTOSes used by embedded software developers as well as typical RTOS features.

RTOS Examples

Examples of open-source and commercial RTOS include:

  • Embedded Linux is a version of the Linux operating system designed to run on embedded systems. Is embedded Linux an RTOS? No, it is a general-purpose OS used in the embedded space. Most embedded Linux distributions require many megabytes of memory and a memory management unit (MMU).
  • FreeRTOS, under stewardship of Amazon, is a minimalist open-source RTOS capable of running on a wide range of platforms and processor architectures.
  • PX5 RTOS is an ultrasmall RTOS with sub-microsecond task switching and security features. PX5 RTOS is designed and certified to run safety-critical applications.
  • SAFERTOS, developed by WHIS, is designed to run safety-critical applications and is pre-certified to facilitate compliance with functional safety standards.
  • ThreadX, developed by WHIS, is designed to run safety-critical applications and is pre-certified to facilitate compliance with functional safety standards.
  • VxWorks, developed by WHIS, is designed to run safety-critical applications and is pre-certified to facilitate compliance with functional safety standards.
  • Zephyr, developed by WHIS, is designed to run safety-critical applications and is pre-certified to facilitate compliance with functional safety standards.
RTOS

RTOS Features

In this section, you’ll learn about six RTOS features to consider for your next embedded project: determinism, spatial and temporal separation, scheduling, preemptive and cooperative RTOS, memory management, and interprocess communications.

Deterministic RTOS

An RTOS that guarantees a task runs in a specified amount of time is called deterministic. Some RTOSes may guarantee determinism even with unexpected inputs! PX5 RTOS is an example of a deterministic RTOS with submicrosecond context switching and API calls.

Spatial vs. Temporal Separation

Spatial separation, or spatial isolation, allows tasks to run in their own private memory spaces. Temporal separation allows tasks to meet timing requirements without interference.

RTOS Scheduling

A scheduling algorithm decides the order in which tasks are run on processing units, so they can each meet their time constraints. A thread is a unit of work that can run concurrently with other threads. RTOS schedulers use priority, absolute and relative deadlines, and state to manage threads:

  • Priority. Threads with higher priority preempt tasks at lower priority when necessary. This allows critical tasks, such as a car’s throttle control, to run without being delayed by less important tasks, such as data logging.
  • Deadline. An absolute deadline is the exact time by which a job must be completed. A relative deadline is the maximum allowable completion time.
  • State. A thread is either ready (available for execution), running, or blocked (waiting for an event, such as network data).

Preemptive or Cooperative Multitasking
Preemptive and cooperative multitasking are two methods an RTOS uses to execute multiple tasks or processes at once. A preemptive RTOS may stop the execution of a task to allocate the CPU to another process. By contrast, in cooperative multitasking, only the task itself can yield control.

RTOS Memory Management

An RTOS divides physical memory into sections, called stack and heap, to share it. The stack stores a function's call information and its local variables, which requires careful management. The heap allocates dynamic memory for global information for sharing. To manage memory effectively, an RTOS uses techniques, such as first-fit and best-fit.

Interprocess Communication (IPC)

Interprocess communication enables processes to synchronize and communicate with each other, such as passing messages and sharing memory. An RTOS enables this communication through queues, semaphores, and mutexes.

  • RTOS queues are first-in, first-out (FIFO) buffers in memory that support the passing of messages between tasks.
  • RTOS semaphores are signals between tasks that trigger an action by the receiving task.
  • RTOS mutexes are flags used to protect critical sections of code. They allow access by only one thread at a time.
RTOS

RTOS Best Practices

In this section, you’ll learn about POSIX compliance, security, and functional safety certification, which are three RTOS development best practices.

POSIX Compliance

POSIX pthreads are an industry-standard set of APIs for multithreading. This includes threads, semaphores, mutexes, condition variables, signals, timers. An RTOS supporting the POSIX threads (pthreads) API reduces developer training and effort, as most Linux distributions are POSIX-compliant.

Any application using a POSIX-compliant RTOS call can be ported to another compliant RTOS with minimal effort.

Examples below show one standards-based API call to create a semaphore, followed by three propriety API calls, each different:

Standards-based IEEE POSIX API used to create a semaphore (including PX5 RTOS)

int sem_init(sem_t* semaphore_handle, int pshared, unsigned int value);

RTOSes that use proprietary APIs to create a semaphore

ThreadX RTOS API
UINT tx_semaphore_create(TX_SEMAPHORE* semaphore_handle, CHAR* name, ULONG initial_count);
FreeRTOS API
SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t unInitialCount);
Zephyr RTOS API
int k_sem_init(struct k_sem* sem, unsigned int initial_count, unsigned int limit);

RTOS Security

RTOS security requires spatial separation between tasks to prevent a compromised component from affecting other components.

As a secure RTOS, PX5 RTOS provides security-specific enhancements for memory corruption detection and mitigation. Known as pointer data verification (PDV), this feature verifies all function pointers before calling them and verifies the return address on the stack. In addition, data objects and memory pools can be verified to prevent most sequential corruption. Central error processing is called when corruption is detected.

Safety-Certified RTOS

Embedded devices are often used in safety-critical situations that could cause human injury or property damage if they malfunction. Examples of safety-critical systems include medical, industrial, and automotive applications. Proving functional safety in embedded devices requires a fully tested and verified RTOS as well as certifications, such as compliance with the IEC 61508 international functional safety standard for electronic and programmable systems.

A safety-certified RTOS, also called a pre-certified RTOS, complies with one or more of the functional safety standards, such as IEC 61508 (industrial) or ISO 26262 (automotive). A safety-certified RTOS meets industry best practices. A safety-certified RTOS helps developers achieve greater product reliability, security, and quality as well as faster time to market.

As an example, PX5 RTOS is pre-certified to the highest levels of the IEC 61508, IEC 62304, ISO 26262 and EN 50128 functional safety standards. Embedded software developers who use PX5 RTOS can re-use the certification artifacts provided by PX5 to save time and money when they safety-certify their application.

RTOS

How to Choose the Best RTOS

Your choice of RTOS affects embedded system performance, development time, regulatory compliance, and total cost. The overhead an RTOS imposes on the processor and response time of RTOS functions affect system performance, such as:

  • Interrupt latency: The delay between an interrupt coming from an external event and the response to that interrupt.
  • Context switch time: The time it takes to switch from between tasks, a big factor in system performance.
  • Memory footprint: The amount of physical memory (ROM and RAM) required by the RTOS to store kernel code, runtime libraries, and middleware as well as application processing overhead.

Several more RTOS selection criteria include:

Bare Metal vs. Open Source vs. Commercial RTOS

When deciding whether to use a bare metal, open source RTOS, or commercial RTOS, consider the following:

  • Bare metal systems have applications running directly on hardware with no intermediate software layers. These systems are easier to optimize for performance but require more effort to add features and secure as there is little to no ecosystem support.
  • Open source RTOSes are freely available and come with community-driven features and support. They often lack enterprise-level support, unless it is purchased separately.
  • Commercial RTOSes are optimized for a range of use cases and are backed by professional engineering and support teams to roll out features and solve issues quickly.
RTOS

How Can PX5 RTOS Help You?

Fastest in 2024 RTOS Performance Report

PX5 RTOS is one of the smallest, highest performance RTOSes ever developed. Ideal for resource-constrained devices, PX5 RTOS delivers sub-microsecond context switching and API calls, and it requires less than 1 KB of flash memory to run. Designed as a native implementation of the POSIX pthreads API standard, PX5 RTOS enables code portability with embedded Linux and other POSIX RTOSes.

Secure and Safety-Certified RTOS

PX5 RTOS helps embedded developers meet system requirements for RTOS cybersecurity and functional safety in these ways:

  • PX5 tests its entire RTOS code base with complete C statement and branch decision coverage for every release.
  • Pointer data verification (PDV) technology provides added security through run-time function pointer, system object, buffer and stack verification.
  • SGS-TÜV Saar—the leading accredited, independent company for testing, auditing, verifying, and certifying embedded software for safety-related systems-certifies PX5 RTOS as meeting the functional safety standards IEC 61508 SIL 4 (electronic), IEC 62304 Class C (medical), ISO 26262 ASIL D (automotive) and EN 50128 SW-SIL 4 (rail).
RTOS
Mouse over for component details
PX5 RTOS C Implementation (px5.c) PX5 RTOS Binding Layer (px5_binding.s)

Figure 1: Components of the PX5 RTOS

PX5 RTOS Benefits and Highlights

Rich determinism makes PX5 RTOS ideal for the most demanding real-time embedded applications. Features include:

  • Advanced 5th generation RTOS by the author of ThreadX and Nucleus
  • Complete source code, written in ANSI C, including the RTOS binding layer source
  • Royalty-free licensing
  • Asymmetric multiprocessing (AMP) and symmetric multiprocessing (SMP) support
  • Works with ARM Cortex-M, Cortex-R, Cortex-A, and RISC-V architecture processors
  • Works with a range of boards from semiconductors, including AMD, GigaDevice, NXP Semiconductors, Renesas, SiFive, STMicroelectronics and Texas Instruments
  • Expert tech support, rich documentation, and helpful videos to simplify use

To learn more about PX5 RTOS, explore our product page.

 
RTOS markets

The PX5 RTOS enables you to deliver better quality IoT devices in record time for the most demanding applications.

  • System-on-Chip (SoC)
  • Industrial
  • Medical Devices
  • Consumer Electronics
  • Automotive
  • Office Automation
  • Networking
  • Military/Aerospace
Discover PX5 RTOS

Your Feedback

Matters!

Please answer 5 quick questions to help us better meet your needs!

What do you like about the PX5 RTOS?

What do you dislike about the PX5 RTOS?

What would you like to see the PX5 RTOS?

What do you like about our website?

How can we improve our website?

Survey Completed

Thank you

We sincerely appreciate your valuable input and the time you’ve taken to complete a survey.