Bird
0
0

You want to monitor stack usage of multiple tasks and log a warning if any task's stack high water mark falls below 20 words. Which approach is best?

hard📝 Best Practice Q15 of 15
FreeRTOS - Debugging and Monitoring

You want to monitor stack usage of multiple tasks and log a warning if any task's stack high water mark falls below 20 words. Which approach is best?

AOnly check the current task's stack high water mark using NULL parameter
BIncrease all task stack sizes to 20 words to avoid overflow
CPeriodically call <code>uxTaskGetStackHighWaterMark</code> for each task handle and check if value < 20
DUse <code>vTaskDelete</code> to remove tasks with low stack
Step-by-Step Solution
Solution:
  1. Step 1: Understand monitoring multiple tasks

    To monitor multiple tasks, you must check each task's stack high water mark individually using their task handles.
  2. Step 2: Implement threshold check

    Calling uxTaskGetStackHighWaterMark for each task and comparing to 20 words allows detecting low stack and logging warnings.
  3. Final Answer:

    Periodically call uxTaskGetStackHighWaterMark for each task handle and check if value < 20 -> Option C
  4. Quick Check:

    Check each task's high water mark against threshold [OK]
Quick Trick: Check each task's high water mark, compare to threshold [OK]
Common Mistakes:
  • Checking only current task misses others
  • Assuming increasing stack size fixes monitoring
  • Deleting tasks instead of warning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes