Bird
0
0

In FreeRTOS with preemptive scheduling, three tasks exist: TaskA (priority 2), TaskB (priority 3), and TaskC (priority 1). TaskB blocks waiting for a mutex. Which task runs next?

hard📝 Application Q8 of 15
FreeRTOS - Task Scheduling
In FreeRTOS with preemptive scheduling, three tasks exist: TaskA (priority 2), TaskB (priority 3), and TaskC (priority 1). TaskB blocks waiting for a mutex. Which task runs next?
ATaskA runs because it has the highest ready priority
BTaskC runs because TaskB is blocked and TaskA has lower priority
CTaskB runs despite being blocked
DIdle task runs since TaskB is blocked
Step-by-Step Solution
Solution:
  1. Step 1: Identify task states

    TaskB is blocked waiting for a mutex, so it cannot run.
  2. Step 2: Determine highest priority ready task

    TaskA (priority 2) and TaskC (priority 1) are ready; TaskA has higher priority.
  3. Step 3: Scheduler decision

    The scheduler runs the highest priority ready task, which is TaskA.
  4. Final Answer:

    TaskA runs because it has the highest ready priority -> Option A
  5. Quick Check:

    Blocked tasks do not run; highest ready priority runs [OK]
Quick Trick: Blocked tasks don't run; highest ready priority task runs [OK]
Common Mistakes:
  • Assuming blocked task runs
  • Choosing lower priority ready task
  • Thinking idle task runs unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes