Bird
0
0

You are designing a Resource Manager Task to handle both sensor read and actuator write requests. Which data structure design best supports efficient request differentiation and processing?

hard📝 Application Q8 of 15
FreeRTOS - Design Patterns for RTOS
You are designing a Resource Manager Task to handle both sensor read and actuator write requests. Which data structure design best supports efficient request differentiation and processing?
AUse separate queues for read and write requests
BUse a struct with a command type field and a union for read/write data
CUse a single integer field to encode both command and data
DUse global variables to store request type and data separately
Step-by-Step Solution
Solution:
  1. Step 1: Requirement for request differentiation

    The task must distinguish request types efficiently.
  2. Step 2: Struct with command and union

    A struct with a command field and union allows compact, clear representation of different data types.
  3. Step 3: Evaluate other options

    Separate queues add complexity; encoding in one int is error-prone; globals reduce modularity.
  4. Final Answer:

    Struct with command and union -> Option B
  5. Quick Check:

    Use command field plus union for varied request data [OK]
Quick Trick: Use command field plus union for multiple request types [OK]
Common Mistakes:
  • Using multiple queues unnecessarily
  • Encoding multiple data in one integer
  • Relying on global variables for request data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes