FreeRTOS task priorities


I usually define the FreeRTOS tasks as equal to the idle task priority plus 1.

Nevertheless if I have:

Task A priority 5
Task B priority 10

Will Task A run when Task B is blocked on a semaphore?


FreeRTOS will ALWAYS (at least when you have preemption turned on) run the highest priority task that is ready. Tasks that are blocked, aren’t ready. So if you only have those tasks A and B, then B will run if it is ready, and when it isn’t A will run. If neither of them are ready, then the Idle task will run (The Idle task is always ready so the schedule has somewhere to put any execution time that it otherwise doesn’t have something to schedule).