Bird
0
0

How should you assign their priorities to ensure timely sensor readings without starving the display?

hard📝 Application Q8 of 15
FreeRTOS - RTOS Fundamentals
In a FreeRTOS application, you have two tasks: TempSensorTask reads temperature every 50 ms, and DisplayTask updates the screen every 200 ms. How should you assign their priorities to ensure timely sensor readings without starving the display?
AAssign equal priority to both tasks.
BAssign higher priority to TempSensorTask and lower to DisplayTask.
CAssign higher priority to DisplayTask and lower to TempSensorTask.
DAssign lowest priority to both tasks and use vTaskDelay for timing.
Step-by-Step Solution
Solution:
  1. Step 1: Understand task timing requirements

    TempSensorTask must run every 50 ms (more frequent), DisplayTask every 200 ms (less frequent).
  2. Step 2: Prioritize tasks based on timing criticality

    Higher priority should be given to the more time-critical task (TempSensorTask) to ensure it runs on time.
  3. Step 3: Avoid starving lower priority task

    Since DisplayTask runs less frequently, lower priority is acceptable but it should still get CPU time when TempSensorTask is idle.
  4. Final Answer:

    Assign higher priority to TempSensorTask and lower to DisplayTask. is correct.
  5. Quick Check:

    Higher priority for more frequent task [OK]
Quick Trick: Prioritize tasks by frequency and timing needs [OK]
Common Mistakes:
  • Assigning equal priority causing timing issues
  • Prioritizing less frequent task higher
  • Using delays without priority consideration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes