Bird
0
0

Given the following FreeRTOS code snippet, which task will run first?

medium📝 Predict Output Q13 of 15
FreeRTOS - Task Creation and Management

Given the following FreeRTOS code snippet, which task will run first?

void TaskA(void *pvParameters) { while(1) {} }
void TaskB(void *pvParameters) { while(1) {} }

xTaskCreate(TaskA, "A", 1000, NULL, 2, NULL);
xTaskCreate(TaskB, "B", 1000, NULL, 4, NULL);
ATaskB
BTaskA
CBoth run simultaneously
DNeither runs
Step-by-Step Solution
Solution:
  1. Step 1: Identify task priorities

    TaskA has priority 2, TaskB has priority 4.
  2. Step 2: Determine which runs first

    TaskB has higher priority, so it runs before TaskA.
  3. Final Answer:

    TaskB -> Option A
  4. Quick Check:

    Higher priority task runs first [OK]
Quick Trick: Higher priority number runs first [OK]
Common Mistakes:
  • Assuming tasks run in creation order
  • Thinking equal priority means simultaneous run
  • Ignoring priority values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes