Bird
0
0

Identify the error in this FreeRTOS code snippet for a hard real-time task:

medium📝 Debug Q14 of 15
FreeRTOS - RTOS Fundamentals
Identify the error in this FreeRTOS code snippet for a hard real-time task:
void vTaskFunction(void *pvParameters) {
  while(1) {
    // Critical processing
    vTaskDelay(1000);
  }
}
What is the problem?
AvTaskDelay should be replaced with vTaskDelete.
BThe task function lacks a return statement.
CThe infinite loop will crash FreeRTOS.
DUsing vTaskDelay causes deadline misses in hard real-time tasks.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze vTaskDelay in hard real-time context

    vTaskDelay pauses the task, which can cause missing strict deadlines in hard real-time.
  2. Step 2: Check other options for correctness

    Return statement is not needed in infinite loop, infinite loops are normal, vTaskDelete deletes task, not delay.
  3. Final Answer:

    Using vTaskDelay causes deadline misses in hard real-time tasks. -> Option D
  4. Quick Check:

    Hard real-time tasks avoid vTaskDelay [OK]
Quick Trick: Hard real-time tasks avoid delays that cause misses [OK]
Common Mistakes:
  • Thinking infinite loops crash FreeRTOS
  • Confusing vTaskDelay with task deletion
  • Expecting return in infinite loops

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes