You want to implement a task pool in FreeRTOS that scales the number of active worker tasks based on workload demand. Which design approach is most appropriate?
hard📝 Application Q8 of 15
FreeRTOS - Design Patterns for RTOS
You want to implement a task pool in FreeRTOS that scales the number of active worker tasks based on workload demand. Which design approach is most appropriate?
ACreate a fixed number of worker tasks and use a queue to buffer work items, adjusting task priorities dynamically
BDynamically create and delete worker tasks as workload changes, ensuring proper synchronization and resource cleanup
CUse a single high-priority task to process all work items sequentially to avoid complexity
DAssign each incoming work item to a new task without pooling to maximize parallelism
Step-by-Step Solution
Solution:
Step 1: Understand dynamic scaling needs
The number of active workers should increase or decrease based on workload.
Step 2: Evaluate options
Creating and deleting tasks dynamically allows adapting to workload but requires careful synchronization.
Step 3: Why other options are less suitable
Fixed tasks with priority changes don't scale number of tasks; single task limits concurrency; no pooling wastes resources.
Final Answer:
Dynamically create and delete worker tasks as workload changes, ensuring proper synchronization and resource cleanup -> Option B