Bird
0
0

Which approach best applies the Resource Manager Task Pattern to handle this efficiently?

hard📝 Application Q15 of 15
FreeRTOS - Design Patterns for RTOS
You want to design a Resource Manager Task that handles multiple resource types (e.g., UART, SPI) with different commands. Which approach best applies the Resource Manager Task Pattern to handle this efficiently?
ACreate separate manager tasks for each resource type and let clients send requests directly to each
BLet clients access resources directly with mutexes protecting each resource
CUse a single queue with a message struct containing resource type and command fields, then switch-case inside the manager task
DUse global variables to store resource states and update them without task communication
Step-by-Step Solution
Solution:
  1. Step 1: Consider centralized control for multiple resources

    A single Resource Manager Task can handle multiple resource types by differentiating requests.
  2. Step 2: Use message struct with resource type and command

    This allows the manager task to use a switch-case to process requests efficiently and safely.
  3. Final Answer:

    Use a single queue with a message struct containing resource type and command fields, then switch-case inside the manager task -> Option C
  4. Quick Check:

    Single queue + message struct = efficient multi-resource management [OK]
Quick Trick: Use message struct with resource type and switch-case in manager [OK]
Common Mistakes:
  • Creating multiple manager tasks unnecessarily
  • Allowing direct resource access with mutexes
  • Using global variables without communication

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes