Comparison of Features of RTOS: uCOS, FreeRTOS, RTThread, RTX

(The following content is sourced from the internet for discussion purposes, copyright belongs to author @坚强的山猫)1. FreeRTOS

  FreeRTOS is a scalable real-time kernel designed specifically for small embedded systems. Highlights include:

  • Very small packaging.

  • Free RTOS scheduler.

  • Free embedded software source code.

  • Royalty-free.

  • Preemptive, cooperative, and hybrid configuration options with optional time slicing.

  • SafeRTOS derivatives provide a high level of confidence in code integrity.

  • Includes a tickless mode designed for low-power applications.

  • RTOS objects (tasks, queues, semaphores, software timers, mutexes, and event groups) can be created using dynamically or statically allocated RAM.

  • Official support for >30 embedded system architectures (integrating ARM7 and ARM Cortex-M3).

  • FreeRTOS-MPU supports ARM Cortex-M3 Memory Protection Unit (MPU).

  • Designed to be compact and easy to use. Typically, the RTOS kernel binary image will be in the range of 4K to 9K bytes.

  • Highly portable source code structure, primarily written in C.

  • Supports real-time tasks and coroutines.

  • Direct task notifications, queues, binary semaphores, counting semaphores, recursive semaphores, and mutexes for communication and synchronization between tasks or between real-time tasks and interrupts.

  • Innovative event group (or event flag) implementation.

  • Mutexes with priority inheritance.

  • Efficient software timers.

  • Powerful execution tracing capabilities.

  • Stack overflow detection options.

  • Free monitoring forum support or optional commercial support and licensing.

  • No software limits on the number of real-time tasks that can be created.

  • No software limits on the number of task priorities that can be used.

  • No restrictions on task priority assignment – the same priority can be assigned to multiple real-time tasks.

  • Free development tools for many supported architectures.

  • Standard Windows host development.

2. uCOS Family (I/II/III)

  μC/OS-II and μC/OS-III are preemptive, highly portable, and scalable real-time kernels. These kernels are designed for ease of use across a wide range of CPU architectures and are key components of the μC/OS real-time operating system.

Key Values:

  • Portability. Providing unprecedented ease of use, the μC/OS kernel offers complete source code and in-depth documentation. The μC/OS kernel runs on a wide variety of processor architectures, with ports available for download.

  • Scalability. The μC/OS kernel allows unlimited tasks and kernel objects. The kernel’s memory footprint can be minimized to only include the functionality required by the application, typically requiring 6-24 KB of code space and 1 KB of data space.

  • Reliability. The μC/OS kernel includes debugging features that reduce development time. It provides extensive range checking, including checks on pointers passed in API calls, task-level services from ISR, allowing parameters within range, and valid specification options.

  • Efficiency. Micrium’s kernel also includes valuable runtime statistics for visualizing your application’s internals. Identify performance bottlenecks and optimize power usage early in the development cycle.

Features of the μC/OS kernel include the following highlights:

  • Preemptive multitasking real-time kernel with optional round-robin scheduling.

  • Provides complete, clean, consistent source code with in-depth documentation.

  • High scalability: unlimited tasks, priorities, and kernel objects.

  • Wait for multiple kernel objects simultaneously.

  • Direct signaling/messaging to tasks.

  • Resource-efficient: 6K to 24K bytes of code space, 1K+ bytes of data space.

  • Very low interrupt disable time.

  • Extensive performance metrics (configurable).

  • Available for safety-critical applications.

The following table shows the evolution of µC/OS over the years, comparing the features available in each version.

Features

µC/OS

µC/OSII

µC/OSIII

Release Year

1992

1998

2009

Source Code Provided

Book

Preemptive Multitasking

Max Task Count

64

255

Unlimited

Tasks Per Priority Level

1

1

Unlimited

Time-Slice Round-Robin Scheduling

×

×

Semaphore

Mutex

×

√(Nested)

Event Flag Groups

×

Message Mailbox

×(Not Needed)

Message Queue

Fixed Size Memory Management

×

Direct Signaling to Tasks

×

×

No Scheduling Signal Sending Option

×

×

Direct Messaging to Tasks

×

×

Software Timer

×

Task Suspension/Resume

×

√(Nested)

Deadlock Prevention

Configurable

Code Size

3K-8K

6K-26K

6K-24K

Data Size

1K+

1K+

1K+

Code Can Be Fixed

Runtime Configurable

×

×

Compile-Time Configurable

Supports ASCII Naming for Kernel Objects

×

Wait for Multiple Kernel Objects

×

Task Register

×

Built-in Performance Testing

×

Basic

Enhanced

Built-in Trace Points

×

×

User Defined Hook Functions

×

POST Operations with Timestamps

×

×

Kernel-Aware Debugging

×

Scheduler Optimized with Assembly Language

×

×

Capture Exiting Tasks

×

×

Task-Level Clock Tick Handling

×

Number of System Service Functions

~20

~90

~75

3. RT-Thread

Tips: Implement paragraph indentation in markdown

– Half-width space or

– Full-width space or

– Continuous whitespace or

  RT-Thread is an open-source embedded real-time operating system from China, developed and maintained by domestic professionals since 2006. In addition to a real-time operating system kernel similar to FreeRTOS and UCOS, it also includes a series of application components and driver frameworks, such as TCP/IP protocol stack, virtual file system, POSIX interface, graphical user interface, FreeModbus master-slave protocol stack, CAN framework, dynamic modules, etc. It is widely used in high-reliability industries and devices such as new energy, power grids, and wind turbines due to its stability and rich functionality, and has been validated as a highly reliable real-time operating system.

  The RT-Thread real-time operating system follows the GPLv2+ license, allowing the real-time operating system kernel and all open-source components to be freely used in commercial products without the need to disclose application source code, with no potential commercial risks.   The core of the RT-Thread real-time operating system is an efficient hard real-time core, boasting excellent real-time performance, stability, and configurability. When configured minimally, the kernel can occupy 3k ROM and 1k RAM.

  • Task/Thread Scheduling

  In RT-Thread, threads are the smallest scheduling unit, and the thread scheduling algorithm is based on priority with a fully preemptive multi-threading scheduling algorithm, supporting 256 thread priorities (which can also be changed to support a maximum of 32 or 8 thread priorities through configuration files). Priority 0 represents the highest priority, and priority 255 is reserved for idle threads; it supports creating threads of the same priority, with round-robin scheduling algorithm with configurable time slices for threads of the same priority; the scheduler’s time complexity for finding the next highest priority ready thread is constant (i.e., O(1)). There is no limit on the number of threads, only related to the specific memory of the hardware platform.

  • Task Synchronization Mechanism

  The system supports semaphore and mutex as synchronization mechanisms between threads. Mutex uses priority inheritance to solve the priority inversion problem. The release action of the semaphore can be safely used in interrupt service routines. The synchronization mechanism supports threads waiting by priority or FIFO to acquire semaphores or mutexes.

  • Inter-Task Communication Mechanism

  The system supports event, mailbox, and message queue communication mechanisms. Events support multiple event “or” triggers and “and” triggers, suitable for threads waiting for multiple events. The length of a single email in the mailbox is fixed at 4 bytes, which is more efficient than the message queue. The sending action in the communication facility can be safely used in interrupt service routines. The communication mechanism supports threads waiting by priority or FIFO to acquire.

  • Time Management

  The system uses clock ticks to complete time-slice round-robin scheduling for tasks of the same priority; the time sensitivity of threads to kernel objects is achieved through system timers; timers support soft timers and hard timers (soft timer processing occurs in the context of system threads, while hard timer processing occurs in the context of interrupts); timers support one-time timeouts and periodic timeouts.

  • Memory Management

  The system supports static memory pool management and dynamic memory heap management. The time to obtain memory blocks from the static memory pool is constant; when the memory pool is empty, the requesting thread can be blocked (or immediately return, or wait for a period of time before still not obtaining the memory block returns. This depends on the waiting time set during memory block request), and when other threads release memory blocks back to the pool, the corresponding blocked threads will be awakened. Dynamic heap memory management provides small memory management algorithms for small memory systems and SLAB memory management algorithms for large memory systems based on different system resource conditions.

  • Device Management

  The system implements a device management subsystem accessed by name, allowing uniform API interface access to hardware devices. In the device driver interface, events can be attached to different devices according to the characteristics of embedded systems, notifying the upper application when device events are triggered.

RT-Thread also incorporates many of its own ideas, such as Finish and device trees, which are designed based on Linux concepts.

4. RTX

  Keil RTX is a royalty-free, deterministic real-time operating system designed for ARM and Cortex-M devices. It allows you to create programs that execute multiple functions simultaneously and helps create better-structured and more maintainable applications.

Features

  • Royalty-free deterministic RTOS with source code.

  • Flexible scheduling: round-robin, preemptive, and cooperative.

  • High-speed real-time operations with low interrupt latency.

  • Small footprint for resource-constrained systems.

  • Unlimited number of tasks, each with 254 priorities.

  • Unlimited number of mailboxes, semaphores, mutexes, and timers.

  • Supports multithreading and thread-safe operations.

  • Kernel-aware debugging support for MDK-ARM.

  • Dialog-based settings using μVision configuration wizard.

Advantages

  Although real-time programs can be created without an RTOS (by executing one or more functions in a super loop), Keil RTX addresses many scheduling, maintenance, and timing issues that an RTOS can solve for you.

Notes: All versions of MDK-ARM include RTX source code.

I have only used this system once, and I feel its biggest feature is its simplicity, requiring no special considerations, just plug and play, and it doesn’t disable interrupts, so you know~

To summarize briefly: the reason I am posting this article is that people often ask me what operating system to learn. Actually, I want to say that it doesn’t matter what you learn; they are basically interchangeable. Just choose your operating system. At this stage, the materials on real-time operating systems are already very complete. There is no need to get tangled over which operating system to learn.

I chose to learn FreeRTOS because it is open-source abroad and free for commercial use. If you have many products, then you can use this. However, the downside is also very obvious; it lacks some components and peripheral frameworks.

The ucos series is not just a real-time kernel; it also has many accompanying components. Of course, it requires royalties. If you have many products to install, then don’t use it; save that money for us struggling programmers’ salaries.

RT-Thread is a domestically developed IoT operating system. It is also free and has many application components and driver frameworks, such as TCP/IP protocol stack, virtual file system, etc. From a patriotic perspective, I hope domestic products can confidently go abroad. I can understand the FreeRTOS source code, and I feel that getting started with RT-Thread is not difficult. It’s just that when I was learning FreeRTOS, I didn’t know about RT-Thread.

RTX I have only heard of and not understood, so I won’t comment. After saying so much, I feel that being free is good. Also, FreeRTOS is very simple, and I like it. I also hope that China becomes stronger. Losing on hardware (chips) should not lead to losing on software!!!!

Comparison of Features of RTOS: uCOS, FreeRTOS, RTThread, RTX

Let RT-Thread take off

Image credit to the beautiful editor CK

Leave a Comment