CMSIS-RTOS2  Version 2.1.3
Real-Time Operating System: API and RTX Reference Implementation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Control Block Sizes

Keil RTX v5 specific control block definitions (including sizes) as well as memory pool and message queue memory requirements are defined in the header file rtx_os.h:

If you provide memory for the RTOS objects, you need to know the size that is required for each object control block. The memory of the control block is provided by the parameter attr of the related osXxxxNew function. The element cb_mem is the memory address, cb_size is the size of the control block memory.

Refer to Static Object Memory for more information.

The following table lists the control block sizes:

Category Control Block Size Attribute Size #define symbol
Thread Management osThreadAttr_t::cb_mem 68 bytes osRtxThreadCbSize
Timer Management osTimerAttr_t::cb_mem 32 bytes osRtxTimerCbSize
Event Flags osEventFlagsAttr_t::cb_mem 16 bytes osRtxEventFlagsCbSize
Mutex Management osMutexAttr_t::cb_mem 28 bytes osRtxMutexCbSize
Semaphores osSemaphoreAttr_t::cb_mem 16 bytes osRtxSemaphoreCbSize
Memory Pool osMemoryPoolAttr_t::cb_mem 36 bytes osRtxMemoryPoolCbSize
Message Queue osMessageQueueAttr_t::cb_mem 52 bytes osRtxMessageQueueCbSize