You are viewing an older revision! See the latest version
RTOS Memory Model
Mbed OS 2 and Mbed OS 5
This is the handbook for Mbed OS 2. If you’re working with Mbed OS 5, please see the Mbed OS 5 documentation. For the latest information about RTOS, please see the RTOS API.
Memory Model
- mbed Memory Model
- RTOS Memory Model
This is a basic overview of the memory model used by the mbed RTOS.
Threads¶
Each thread of execution in the RTOS has its separate stack.
When you use the RTOS, before explicitly initializing any additional thread, you will have 4 separate stacks:
- The stack of the
Main Thread
(executing themain
function). - The
Idle Thread
executed each time all the other threads are waiting for external, or scheduled events. This is particularly useful to implement energy saving strategies. (iesleep
). - The
Timer Thread
that executes all the time scheduled tasks (periodic and non periodic). - The stack of
OS Scheduler
itself (also used by the ISRs).
+-------------------+ Last Address of RAM | Scheduler Stack | +-------------------+ | Main Thread Stack | | | | | v | +-------------------+ RAM | | | | +-------------------+ | ^ | | | | | Heap | +-------------------+ | ZI | +-------------------+ | ZI: Idle Stack | +-------------------+ | ZI: Timer Stack | +-------------------+ | RW | +===================+ First Address of RAM | | Flash | |