Bird
0
0

Given two FreeRTOS tasks: Task1 (priority 1) is running, and Task2 (priority 2) becomes ready. What will FreeRTOS do next if preemptive scheduling is enabled?

medium📝 Predict Output Q4 of 15
FreeRTOS - Task Scheduling
Given two FreeRTOS tasks: Task1 (priority 1) is running, and Task2 (priority 2) becomes ready. What will FreeRTOS do next if preemptive scheduling is enabled?
ATask2 waits until Task1 finishes its time slice
BTask1 continues running until it blocks or yields
CBoth tasks run simultaneously on separate cores
DTask2 immediately preempts Task1 and starts running
Step-by-Step Solution
Solution:
  1. Step 1: Identify task priorities

    Task2 has higher priority (2) than Task1 (1).
  2. Step 2: Understand preemptive scheduling behavior

    With preemption enabled, a higher priority ready task immediately preempts the running lower priority task.
  3. Final Answer:

    Task2 immediately preempts Task1 and starts running -> Option D
  4. Quick Check:

    Higher priority task preempts running task immediately [OK]
Quick Trick: Higher priority ready task preempts running task immediately [OK]
Common Mistakes:
  • Assuming tasks run concurrently on single-core
  • Believing lower priority task runs until time slice ends
  • Ignoring preemption setting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes