Bird
0
0

Given this FreeRTOS idle hook code:

medium📝 Predict Output Q5 of 15
FreeRTOS - Task Scheduling

Given this FreeRTOS idle hook code:

void vApplicationIdleHook(void) {
vTaskDelay(1000);
printf("Idle hook delay\n");
}

What will happen when this runs?

AIdle hook delays 1 second and prints message repeatedly
BSystem will crash or behave unexpectedly due to calling vTaskDelay in idle hook
CIdle hook runs without delay and prints immediately
DIdle hook disables the scheduler
Step-by-Step Solution
Solution:
  1. Step 1: Recall restrictions on idle hook

    Calling blocking functions like vTaskDelay inside the idle hook is not allowed and causes issues.
  2. Step 2: Analyze the effect

    Using vTaskDelay in idle hook can cause system crash or unexpected behavior.
  3. Final Answer:

    System will crash or behave unexpectedly due to calling vTaskDelay in idle hook -> Option B
  4. Quick Check:

    Blocking calls in idle hook cause errors = A [OK]
Quick Trick: Never call blocking functions like vTaskDelay inside idle hook [OK]
Common Mistakes:
  • Assuming vTaskDelay works normally in idle hook
  • Thinking idle hook disables scheduler
  • Ignoring restrictions on idle hook functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes