Bird
0
0

How can you safely shut down all worker tasks in a task pool when the system needs to stop processing work items?

hard📝 Application Q9 of 15
FreeRTOS - Design Patterns for RTOS
How can you safely shut down all worker tasks in a task pool when the system needs to stop processing work items?
ASend a special 'shutdown' work item to the queue for each worker to detect and exit
BDelete the queue immediately, causing tasks to crash and stop
CSuspend all tasks using vTaskSuspend(NULL) inside each worker
DIncrease task priorities to prevent them from running
Step-by-Step Solution
Solution:
  1. Step 1: Understand safe shutdown method

    Sending a special item lets each worker detect shutdown and exit cleanly.
  2. Step 2: Evaluate other options

    Deleting queue causes crashes, suspending tasks inside themselves is incorrect, priority increase does not stop tasks.
  3. Final Answer:

    Send a special 'shutdown' work item to the queue for each worker to detect and exit -> Option A
  4. Quick Check:

    Use special queue items for graceful shutdown [OK]
Quick Trick: Use special queue messages to signal workers to exit [OK]
Common Mistakes:
  • Deleting queue abruptly
  • Suspending tasks incorrectly
  • Changing priorities to stop tasks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes