Keil mdk rtx real-time operating system

Source: Internet
Author: User

Keil RTX is a royalty-free, deterministic real-time operating system for ARM and cortex-m devices. With this system, you can create programs that execute multiple functions at the same time, and create applications with better structure and easier maintenance.

  • Royalty-free and deterministic RTOS with source code
  • Flexible scheduling: loop, preemptive, and collaborative
  • High-speed real-time operations with low interrupt latency
  • Small space usage applies to systems with limited resources
  • Unlimited number of tasks. Each task has 254 priorities.
  • Unlimited number of mailboxes, signals, mutex functions, and timers
  • Supports multi-threaded and thread-safe operations
  • Support for Kernel identification debugging in MDK-ARM
  • Use the dialog box settings in the Configuration Wizard of micro vision

Although real-time programs can be created without RTOS (by executing one or more functions in a superloop), RTOS such as Keil RTX can solve many scheduling, maintenance, and timing problems for you. For more details about the comparison between RTOS and Super Loop, see the advantages of using RTOS.








Task Type

Task defined (max)


Activity Task


Task defined (max)


User priority


Stack check

Context switching time

<300 cycles

Suspension lock time





User Timer



16 tasks per task

Inter-Task Communication

Event (max)



16 tasks per task

Signal (max)


Mutex (max)


Email (max)


Mailbox size

Unlimited (default: 20)




Task Type

Performance (period)

Interruption Delay

Not applicable. See the notes.

Initialize the system and start the task.


Create a task (no task switchover)


Create a task (Task Switching)


Delete a task


Task Switching


Set events


Send signal


Send message




Memory Requirements

Task Type


Code size

<4.0 KBytes

Kernel RAM Space

<300 Bytes + 128 Bytes User Stack

Task RAM Space

TaskStackSize + 52 bytes

RAM space of the mailbox

MaxMessages * 4 + 16 bytes

Signal RAM Space

8 bytes

The RAM space of the mutex.

12 bytes

RAM space of the user Timer

8 bytes

Hardware requirements

SysTick Timer


Memory Requirements
Task Type Performance
Code size <4.0 KBytes
Kernel RAM Space <300 Bytes + 128 Bytes User Stack
Task RAM Space TaskStackSize + 52 bytes
RAM space of the mailbox MaxMessages * 4 + 16 bytes
Signal RAM Space 8 bytes
The RAM space of the mutex. 12 bytes
RAM space of the user Timer 8 bytes
Hardware requirements SysTick Timer


  • The RTX kernel for this test is configured for 10 tasks, 10 user timers, and stack check disabled.
  • The ram requirement depends on the number of tasks running at the same time.
  • The code and ram size are calculated using the micolib Runtime Library.

The Keil RTX real-time operating system provides many advanced features, which are not always provided in RTOs products of other vendors. When selecting RTOS, consider the following:

  • Rtx included in the MDK-ARM-Full-featured, commercial RTX (including source code) as Keil
    A part of the MDK-ARM development tool is provided. This is not an evaluation version. It can be fully configured without any restrictions. Therefore, if you plan to use MDK for development, RTX is free of charge.
  • RTX royalty-free-RTX is royalty-free. After obtaining the license, you can use the products created by RTX without any additional fees or subsequent costs.
  • Market-leading RTOS-RTX has always been one of the leading RTOS in embedded applications (TechInsights embedded market survey report in 2010 ). You can use RTX in applications with confidence.
  • Flexible scheduling-RTX provides three different kernel scheduling options. You can use the options that best suit your application:
    • Preemptive-each task has a different priority and runs only when the task with a higher priority is ready for running. This option is often used in interactive systems. The device may be in standby or background mode before the user inputs something.
    • Loop-each task runs a fixed CPU runtime segment (time segment ). Data Recorder/system display usually uses cyclic scheduling. All sensors or data sources sample data in sequence, regardless of priority.
    • Collaboration-each task runs until it instructs it to pass control to another task or to block OS calls. You can view collaborative multitasking in applications that require a fixed execution sequence.
  • Deterministic behavior-Not every RTOS is deterministic. RTX provides completely deterministic behavior, which means processing events and interruptions within a predefined period of time. Your applications can rely on consistent and known process timing.
  • Designed for Embedded Systems-RTX is specially designed for Embedded Systems Based on ARM and Cortex-m mcu. It is not rewritten based on a large operating system or other architecture. It runs fast, occupies very few MCU resources, and the memory usage is only 5 kb (ROM ).
  • Easy to use-Short learning cycles and fast product development. The micro Vision IDE/debugger fully supports RTX, which uses the RTX task identification tool to quickly and conveniently configure and debug RTX in your applications.
  • Source code-RTX source code is included in all MDK-ARM versions. This is useful when source code is required for product authentication.
  • Supported-Provides a wide range of resources, including examples, user guides, and printed Quick Start guides. Keil fully supports RTX.
RTOS advantages

Simple embedded systems are usually usedSuper LoopConcept, where the application executes each function in a fixed order. The interrupt service routine (ISR) is used for key time programs. This method is suitable for small systems, but it imposes restrictions on complicated applications.

Super Loop ConceptDisadvantages
  • Key operations must be processed within the interrupt (ISR ).

    • ISR functions become very complex and take a long time to execute
    • ISR nesting may produce unpredictable execution time and stack requirements
  • Super LoopData exchange with ISR is performed through global shared variables.
    • Application programmers must ensure data consistency
  • Super LoopIt can be easily synchronized with the system timer,:
    • If the system requires multiple cycles, it is difficult to implement
    • Split exceedsSuper LoopCyclic time-consuming Functions
    • Software overhead is hard to understand
  • Super LoopApplications become very complex and therefore difficult to expand
    • A simple change may produce unpredictable side effects, which are time-consuming for analysis.

Super LoopThese disadvantages can be solved by using real-time operating system (RTOs.

RTOS Concept

RTOS divides program functions into independent tasks and implements on-demand Scheduling for their execution. Advanced RTOS (such as Keil RTX) provides the following important advantages:

  • Task Scheduling-The task is called as needed to ensure better program stream and Event Response.
  • Multi-task-Task Scheduling will have the effect of executing multiple tasks at the same time.
  • Deterministic behavior-Handle events and interruptions within the defined time period
  • Shorter ISR-More definite interruption Behavior
  • Inter-Task Communication-Manage data, memory, and hardware resource sharing among multiple tasks
  • Defined stack usage-Allocate a defined stack space for each task to implement predictable memory usage.
  • System Management-Focus on application development rather than Resource Management (housekeeping)

Tasks 1 and 2 are functions in the application. RTX provides the memory pool and mailbox management and communication mechanism between tasks.

RTX provides a simple syntax for direct access to all RTOS resources.

Software Tools>
Middleware library> RTX


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.