0
0
FreeRTOSprogramming~5 mins

Static vs dynamic allocation (configSUPPORT_STATIC_ALLOCATION) in FreeRTOS - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is static allocation in FreeRTOS?
Static allocation means reserving memory at compile time. The memory for tasks, queues, or other objects is fixed and does not change during program execution.
Click to reveal answer
beginner
What is dynamic allocation in FreeRTOS?
Dynamic allocation means reserving memory at runtime using functions like pvPortMalloc. Memory can be allocated and freed as the program runs.
Click to reveal answer
intermediate
What does the configSUPPORT_STATIC_ALLOCATION setting control?
It controls whether FreeRTOS allows creating tasks and other objects using static allocation. If set to 1, static allocation is supported; if 0, only dynamic allocation is allowed.
Click to reveal answer
intermediate
Name one advantage of static allocation over dynamic allocation in FreeRTOS.
Static allocation avoids fragmentation and runtime memory failures because memory is fixed and known at compile time.
Click to reveal answer
intermediate
Why might dynamic allocation be risky in embedded systems?
Dynamic allocation can cause memory fragmentation and allocation failures during runtime, which may lead to system instability or crashes.
Click to reveal answer
What happens if configSUPPORT_STATIC_ALLOCATION is set to 0 in FreeRTOS?
ABoth static and dynamic allocation are allowed.
BOnly static allocation is allowed.
COnly dynamic allocation is allowed for tasks and objects.
DMemory allocation is disabled.
Which of the following is a benefit of static allocation?
AMemory size can change during execution.
BMemory is allocated and freed dynamically.
CRequires more CPU time to allocate memory.
DAvoids runtime memory fragmentation.
In FreeRTOS, which function is commonly used for dynamic memory allocation?
ApvPortMalloc
BmallocStatic
CxTaskCreateStatic
DvPortFreeStatic
What is a key difference between xTaskCreate and xTaskCreateStatic?
AxTaskCreateStatic uses dynamic allocation; xTaskCreate uses static allocation.
BxTaskCreate uses dynamic allocation; xTaskCreateStatic uses static allocation.
CxTaskCreateStatic is deprecated.
DBoth functions use dynamic allocation.
Why is static allocation preferred in safety-critical embedded systems?
AIt guarantees memory availability and avoids runtime failures.
BIt allows memory to be allocated and freed at runtime.
CIt uses less memory than dynamic allocation.
DIt is easier to implement than dynamic allocation.
Explain the difference between static and dynamic allocation in FreeRTOS and when you might use each.
Think about memory timing and reliability.
You got /5 concepts.
    Describe the role of configSUPPORT_STATIC_ALLOCATION in FreeRTOS configuration.
    Focus on what the config option controls.
    You got /4 concepts.