# rtems/rtems architecture

> Architecture diagram of the GitHub repository rtems/rtems, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rtems/rtems
- Repository: https://github.com/rtems/rtems

## Overview

RTEMS is an embedded real-time executive. The principal workflow is an application using RTEMS interfaces to create and manage work; the executive schedules and dispatches threads, while optional services provide communication, timing, storage, and device access. The tree and excerpts show representative implementations, not the whole kernel; the broader capability branches below are retained from the README. Edges cite README-level capability statements where sampled source does not establish a specific runtime call.

Main entry points: [`cpukit/rtems/src/tasksetpriority.c`](https://github.com/rtems/rtems/blob/main/cpukit/rtems/src/tasksetpriority.c) (Scheduling), [`cpukit/score/src/threadhandler.c`](https://github.com/rtems/rtems/blob/main/cpukit/score/src/threadhandler.c) (Thread startup), [`cpukit/score/src`](https://github.com/rtems/rtems/tree/main/cpukit/score/src) (Multiprocessing), [`bsps/aarch64/shared/start`](https://github.com/rtems/rtems/tree/main/bsps/aarch64/shared/start) (Board startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Application interfaces"]
  node_config["Runtime configuration<br/>[config.h]"]
  node_classic_tasks["Classic tasks<br/>[tasks.h]"]
end

subgraph group_kernel["Executive core"]
  node_scheduler["Scheduling<br/>[tasksetpriority.c]"]
  node_thread_dispatch["Thread startup<br/>[threadhandler.c]"]
  node_smp["Multiprocessing"]
end

subgraph group_services["Kernel services"]
  node_ipc_sync["Communication and sync"]
  node_timers["Timers and timeouts"]
  node_memory["Memory allocation"]
  node_filesystems["File systems"]
  node_dynamic_loading["Dynamic loading"]
  node_recording["Event recording<br/>[record-client.c]"]
  node_monitor["Object monitoring<br/>[mon-manager.c]"]
end

subgraph group_platform["Platform support"]
  node_bsp_startup["Board startup"]
  node_clock_driver["Clock management"]
end

subgraph group_drivers["Device drivers"]
  node_bsp_drivers["Board device drivers"]
  node_key_manager["Hardware key manager<br/>[fsl_key_manager.c]"]
end

node_application(("Embedded application"))
node_hardware{{"Embedded hardware"}}

node_application -->|"configures"| node_config
node_application -->|"uses"| node_classic_tasks
node_application -->|"sets scheduling"| node_scheduler
node_application -->|"communicates"| node_ipc_sync
node_application -->|"uses timing"| node_timers
node_application -->|"allocates memory"| node_memory
node_application -->|"uses files"| node_filesystems
node_application -->|"loads code"| node_dynamic_loading
node_application -->|"records events"| node_recording
node_application -->|"monitors objects"| node_monitor
node_bsp_startup -.->|"initializes"| node_hardware
node_clock_driver -.->|"controls clocks"| node_hardware
node_bsp_drivers -->|"drives devices"| node_hardware
node_key_manager -.->|"configures keys"| node_hardware
node_smp -->|"coordinates processors"| node_scheduler
node_thread_dispatch -.->|"dispatches work"| node_scheduler

click node_config "https://github.com/rtems/rtems/blob/main/cpukit/include/rtems/config.h"
click node_classic_tasks "https://github.com/rtems/rtems/blob/main/cpukit/include/rtems/rtems/tasks.h"
click node_scheduler "https://github.com/rtems/rtems/blob/main/cpukit/rtems/src/tasksetpriority.c"
click node_thread_dispatch "https://github.com/rtems/rtems/blob/main/cpukit/score/src/threadhandler.c"
click node_smp "https://github.com/rtems/rtems/tree/main/cpukit/score/src"
click node_ipc_sync "https://github.com/rtems/rtems/tree/main/cpukit/rtems/src"
click node_timers "https://github.com/rtems/rtems/tree/main/cpukit/rtems/src"
click node_memory "https://github.com/rtems/rtems/tree/main/cpukit/score/src"
click node_filesystems "https://github.com/rtems/rtems/tree/main/cpukit/libfs/src"
click node_dynamic_loading "https://github.com/rtems/rtems/tree/main/cpukit"
click node_recording "https://github.com/rtems/rtems/blob/main/cpukit/libtrace/record/record-client.c"
click node_monitor "https://github.com/rtems/rtems/blob/main/cpukit/libmisc/monitor/mon-manager.c"
click node_bsp_startup "https://github.com/rtems/rtems/tree/main/bsps/aarch64/shared/start"
click node_clock_driver "https://github.com/rtems/rtems/blob/main/bsps/arm/altera-cyclone-v/contrib/hwlib/src/hwmgr/alt_clock_manager.c"
click node_bsp_drivers "https://github.com/rtems/rtems/tree/main/bsps/aarch64/raspberrypi"
click node_key_manager "https://github.com/rtems/rtems/blob/main/bsps/arm/imxrt/mcux-sdk/drivers/key_manager/fsl_key_manager.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_classic_tasks toneBlue
class node_scheduler,node_thread_dispatch,node_smp toneAmber
class node_ipc_sync,node_timers,node_memory,node_filesystems,node_dynamic_loading,node_recording,node_monitor toneMint
class node_bsp_startup,node_clock_driver toneRose
class node_bsp_drivers,node_key_manager,node_application,node_hardware toneIndigo
```

## Components

### Application interfaces

- [Runtime configuration](https://github.com/rtems/rtems/blob/main/cpukit/include/rtems/config.h): `cpukit/include/rtems/config.h`
- [Classic tasks](https://github.com/rtems/rtems/blob/main/cpukit/include/rtems/rtems/tasks.h): `cpukit/include/rtems/rtems/tasks.h`

### Executive core

- [Scheduling](https://github.com/rtems/rtems/blob/main/cpukit/rtems/src/tasksetpriority.c): `cpukit/rtems/src/tasksetpriority.c`
- [Thread startup](https://github.com/rtems/rtems/blob/main/cpukit/score/src/threadhandler.c): `cpukit/score/src/threadhandler.c`
- [Multiprocessing](https://github.com/rtems/rtems/tree/main/cpukit/score/src): `cpukit/score/src`

### Kernel services

- [Communication and sync](https://github.com/rtems/rtems/tree/main/cpukit/rtems/src): `cpukit/rtems/src`
- [Timers and timeouts](https://github.com/rtems/rtems/tree/main/cpukit/rtems/src): `cpukit/rtems/src`
- [Memory allocation](https://github.com/rtems/rtems/tree/main/cpukit/score/src): `cpukit/score/src`
- [File systems](https://github.com/rtems/rtems/tree/main/cpukit/libfs/src): `cpukit/libfs/src`
- [Dynamic loading](https://github.com/rtems/rtems/tree/main/cpukit): `cpukit`
- [Event recording](https://github.com/rtems/rtems/blob/main/cpukit/libtrace/record/record-client.c): `cpukit/libtrace/record/record-client.c`
- [Object monitoring](https://github.com/rtems/rtems/blob/main/cpukit/libmisc/monitor/mon-manager.c): `cpukit/libmisc/monitor/mon-manager.c`

### Platform support

- [Board startup](https://github.com/rtems/rtems/tree/main/bsps/aarch64/shared/start): `bsps/aarch64/shared/start`
- [Clock management](https://github.com/rtems/rtems/blob/main/bsps/arm/altera-cyclone-v/contrib/hwlib/src/hwmgr/alt_clock_manager.c): `bsps/arm/altera-cyclone-v/contrib/hwlib/src/hwmgr/alt_clock_manager.c`

### Device drivers

- [Board device drivers](https://github.com/rtems/rtems/tree/main/bsps/aarch64/raspberrypi): `bsps/aarch64/raspberrypi`
- [Hardware key manager](https://github.com/rtems/rtems/blob/main/bsps/arm/imxrt/mcux-sdk/drivers/key_manager/fsl_key_manager.c): `bsps/arm/imxrt/mcux-sdk/drivers/key_manager/fsl_key_manager.c`

### Other components

- **Embedded application**
- **Embedded hardware**

## Connections

- Embedded application → Runtime configuration: configures
- Embedded application → Classic tasks: uses
- Embedded application → Scheduling: sets scheduling
- Embedded application → Communication and sync: communicates
- Embedded application → Timers and timeouts: uses timing
- Embedded application → Memory allocation: allocates memory
- Embedded application → File systems: uses files
- Embedded application → Dynamic loading: loads code
- Embedded application → Event recording: records events
- Embedded application → Object monitoring: monitors objects
- Board startup → Embedded hardware: initializes
- Clock management → Embedded hardware: controls clocks
- Board device drivers → Embedded hardware: drives devices
- Hardware key manager → Embedded hardware: configures keys
- Multiprocessing → Scheduling: coordinates processors
- Thread startup → Scheduling: dispatches work
