Concepts and Characteristics of Embedded Systems
Embedded Systems are specialized computer systems that are embedded within larger devices or systems to perform specific functions. In Internet of Things (IoT) systems, embedded systems act like neural nodes, playing a crucial role in various fields such as smart homes, industrial control, smart energy, intelligent transportation, and smart healthcare.
Embedded systems have distinct characteristics compared to general-purpose computers:
- Dedicated Functionality: Designed for specific tasks (e.g., appliance control, industrial monitoring) rather than general computing.
- Resource Constraints: Typically have limited processing power, memory, and storage space.
- Real-Time Response: Many embedded systems need to respond within strict time limits (e.g., automotive brake control).
- Low Power Consumption and High Reliability: Often used in battery-powered or critical scenarios (e.g., medical devices).

Operating Systems in Embedded Systems
No Operating System
In some minimal applications or devices with extremely low resources (such as simple sensors controlled by 8-bit MCUs), embedded systems can be developed without an operating system (bare-metal development) by directly manipulating registers. This development approach is characterized by direct hardware manipulation, no system overhead, and lower costs, but requires manual management of task scheduling, memory, etc., leading to higher development complexity. For example:
- Temperature sensor controlled by an 8-bit microcontroller: only periodically collects data and sends it via UART (Universal Asynchronous Receiver/Transmitter).
- LED chaser controller: switches GPIO states through simple delay loops.
- Pacemaker: microsecond-level response, OS scheduling delays may affect safety.
- High-precision industrial timer: requires nanosecond-level clock synchronization.
Real-Time Operating Systems vs. General-Purpose Operating Systems
In most applications, it is usually necessary to select an appropriate operating system as the development and application platform. The available operating systems can include Real-Time Operating Systems (RTOS) or General-Purpose Operating Systems (GPOS). For example, in the following application requirements:
- Managing complex tasks and resources
- Multi-task scheduling: When the system needs to handle multiple tasks simultaneously (e.g., data collection + communication + display), the OS uses scheduling algorithms (e.g., priority preemption) to allocate CPU time reasonably, avoiding the complexity of manual task switching.
- Resource sharing: Unified management of memory, peripherals (e.g., sensors, communication modules), file systems, etc., to avoid resource conflicts (e.g., multiple tasks accessing the same hardware simultaneously).
- Hardware abstraction: Provides a unified driver interface (e.g., GPIO, UART), shielding low-level hardware differences, simplifying application development (e.g., controlling sensors from different manufacturers through standard APIs).
- Enhancing real-time performance and reliability
- Deterministic response: Real-Time Operating Systems (RTOS) ensure that critical tasks (e.g., automotive brake control) are completed on time through priority preemption and low-latency task switching (microsecond-level).
- Error isolation: The OS can monitor task status, preventing a single task crash from causing overall system failure (e.g., resetting abnormal tasks through a watchdog mechanism).
- Supporting complex functions and development efficiency
- Advanced feature integration: The OS provides network protocol stacks (e.g., TCP/IP), graphical user interfaces (GUI), security mechanisms (encryption), etc., directly supporting complex applications (e.g., smart home gateways requiring Wi-Fi + Bluetooth + web configuration).
- Rapid development: Utilizing the OS’s middleware (e.g., file systems, databases) and development toolchains (e.g., debuggers, logging systems) shortens development cycles and reduces labor costs.
- Adapting to hardware upgrades and scalability
- Hardware Abstraction Layer (HAL): When hardware upgrades (e.g., MCU model changes) occur, only the OS’s driver layer needs to be adapted, without rewriting application code.
- Modular design: The OS supports dynamic loading/unloading of task modules (e.g., embedded Linux’s insmod), facilitating functional expansion (e.g., adding AI algorithm modules).
Image Source:https://intechhouse.com/blog/
Core Differences Between Real-Time Operating Systems and General-Purpose Operating Systems
The essential difference between RTOS and General-Purpose Operating Systems (using Linux as an example) lies in the trade-off between “determinism” and “generality”:
- RTOS sacrifices functional complexity for absolute determinism in event response, suitable for embedded control scenarios where “time is safety”.
- Linux is the preferred choice in general computing due to its flexible ecosystem and powerful resource management capabilities, but it requires patches or modifications to meet certain real-time demands.
| Dimension | Real-Time Operating System (RTOS) | General-Purpose Operating System (e.g., Linux) |
| Core Objective | Ensure events respond within strict time constraints (hard real-time / soft real-time) | Maximize resource utilization, support multi-task concurrency and complex functions |
| Task Scheduling | Fairness priority | Priority and deadline priority |
| Resource Occupation | Relatively large (memory, CPU overhead) | Extremely small (can be trimmed to KB-level memory) |
| Real-Time Guarantee | Response time is deterministic (μs level, hard real-time must guarantee worst-case delay) | Response time has no strict guarantee (ms level, prioritizing throughput) |
| Typical Scenarios | Industrial control, medical devices, aerospace, embedded sensors | Servers, desktop systems, cloud computing, mobile devices (Android based on Linux) |
Characteristics of Real-Time Operating Systems in Embedded Systems
The architecture, functions, and characteristics of general-purpose operating systems can be learned and understood through studying Linux. The following are some characteristics of embedded real-time operating systems:
Real-time includes hard real-time and soft real-time types
- Hard Real-Time: The system must complete tasks within strict time limits; otherwise, severe consequences may occur (e.g., aerospace, medical devices).
- Soft Real-Time: The system aims to complete tasks within time limits, but occasional delays do not lead to catastrophic consequences (e.g., multimedia playback, smart homes).
Task Scheduling Mechanisms
- Preemptive Scheduling: High-priority tasks can interrupt low-priority tasks to ensure urgent tasks are prioritized (e.g., FreeRTOS default mechanism).
- Non-Preemptive Scheduling: Tasks voluntarily release CPU control, suitable for scenarios with lower real-time requirements.
- Scheduling Algorithms:
- Priority Scheduling: Static priority allocation (e.g., μC/OS) or dynamic adjustment (e.g., EDF earliest deadline first).
- Time-Slice Round Robin: Tasks of equal priority execute in turn according to time slices.
Interrupt Handling
- Interrupt priority is higher than task priority, ensuring quick response to external events.
- Interrupt Service Routines (ISR) must be short and efficient to avoid blocking the system.
Task Communication and Synchronization
- Semaphore: Controls access to shared resources (e.g., mutexes to solve priority inversion issues).
- Message Queue: Passes data between tasks (e.g., sensor data to control modules).
- Event Flag: Multi-task synchronization (e.g., triggers processing tasks after multiple sensor data are ready).
Memory Management
- Static Memory Allocation: Pre-allocates fixed-size memory blocks to avoid fragmentation from dynamic allocation (e.g., RT-Thread’s memory pool).
- Dynamic Memory Allocation: Allocates memory as needed but must control overhead (e.g., FreeRTOS’s pvPortMalloc).
Clock Management
- System Tick (SysTick): Provides a basic time reference (e.g., interrupts once every 1ms).
- Task Delays and Timing: Precisely controls task execution cycles (e.g., PWM waveform generation for motor control).

Common Operating Systems in Embedded Systems and Their Selection
Common Operating Systems in Embedded Systems
General-Purpose Embedded Operating Systems
General-purpose operating systems are suitable for devices with complex functions (e.g., network protocols, graphical interfaces) such as smart home gateways. Common general-purpose operating systems include Linux or Windows Embedded, which can typically be trimmed for use:
- Embedded Linux: Highly customizable, supports a rich protocol stack and drivers (e.g., routers, smart cameras).
- Windows Embedded: Used in commercial devices such as POS machines and ATMs.
Embedded Real-Time Operating Systems
| RTOS Name | Open Source | Typical Application Areas | Characteristics |
| FreeRTOS | Open Source | IoT, Consumer Electronics | Lightweight, active community, supports over 200 chip types, can be trimmed to 4KB memory. |
| μC/OS-III | Commercial / Open Source | Industrial Control, Medical | Modular design, supports preemptive scheduling and memory protection, suitable for high-reliability scenarios. |
| QNX | Commercial | Automotive, Industrial | Microkernel architecture, supports POSIX interfaces, certified by ISO 26262 (automotive functional safety). |
| VxWorks | Commercial | Aerospace, Military | High real-time performance and reliability, supports multi-core processors, compliant with DO-178C (avionics certification). |
| RT-Thread | Open Source | Domestic Embedded, IoT | Supports dynamic components (e.g., file systems, network protocol stacks), ecosystem gradually improving. |
Considerations for Operating System Selection in Embedded Systems

Embedded systems achieve efficient functionality through specialization and resource optimization. In practical applications, developers need to select operating systems based on device resources, real-time requirements, development costs, etc., or adopt compromise solutions like real-time Linux to balance demands. For example:
Hardware Resources:
- Extremely limited resources (e.g., <16KB RAM) → Bare-metal or FreeRTOS.
- Moderate resources (e.g., 128MB RAM) → Embedded Linux or RT-Thread.
Real-Time Requirements:
- Hard real-time (microsecond-level response) → VxWorks, QNX.
- Soft real-time (millisecond-level response) → FreeRTOS, Embedded Linux (requires real-time patches).
Development Ecosystem:
- Open-source requirements → FreeRTOS, RT-Thread, Embedded Linux.
- Commercial support → VxWorks, QNX.
Functional Complexity:
- Simple control → Bare-metal or RTOS.
- Graphical interface, network protocols → Embedded Linux.