Electrical – FreeRTOS – Potential issues with Periodic Tasks

freertosrtosthread

Suppose Task 1 has the highest priority of all tasks, and is run periodically using vTaskDelayUntil().

Task 2 has a lower priority, but is also required to run periodically in strict time intervals.

Does this mean that there may be cases when Task 2 isn't always able to execute at the right time, whereas Task 1 will always execute in the correct intervals?

What difference would setting both tasks to the same priority have, if any?

It is my understanding that an RTOS is supposed to execute tasks predictably/deterministically. How can this issue be avoided?

Best Answer

If the intervals are completely asynchronous, then yes, sometimes one task will have to wait for the other.

If the intervals can be synchronized in some way, then arrange the timing such that the second task runs in the gaps between runs of the first task.

Related Topic