Term of tasks

juhc wrote on Wednesday, August 12, 2015:

How can we know the term of a task in FreeRTOS ?
I mean by term the time by which the task should have finished.
For example : A task may have a duration of 5 and a term of 11. The task can be executed at any time between 0 and 11 but should be finished before 11.
Is there a way to know this ?

rtel wrote on Wednesday, August 12, 2015:

I’m not sure of your distinction between ‘duration’ and ‘term’, but I don’t think that matters to answer the question.

I think you are referring to a time separated kernel, in which the scheduler allocates specific time slots to different tasks, to ensure the tasks are temporaly separated, and one task overrunning cannot eat into time that should be used by a different task. This sort of scheme is typically used in safety critical systems, and the objectives of the scheduler are very different to the objectives of the FreeRTOS scheduler.

If my understanding is correct, then the short answer is - there is no way of specifying a term. FreeRTOS is designed to be small and simple, and time separated kernels are much more complex - too complex in fact to run on some of the tiny processors on which FreeRTOS runs.

That does not however mean you cannot implement your own safety scheme. Many of the FreeRTOS tests do just that by using a high priority task to monitor the running of the low priority tasks to ensure each task gets the processing time it needs, and that each task is in fact still running. There are other ways of doing the same thing - for example you can add code into the tick interrupt (Google vApplicationTickHook) which can monitor tasks, or you can use the trace macros to implement some very sophisticated monitoring functionality.


juhc wrote on Thursday, August 13, 2015:

Sorry I didn’t use the correct word. My english is not so good. It is the deadline of a task that I want to know.

richard_damon wrote on Thursday, August 13, 2015:

FreeRTOS doesn’t deal with deadlines itself. If a task has a deadline (not all do) then it presumes that the programmer has assigned the task priorities (statically or dynamically) to let the task meet it.

A deadline based scheduler is a much different type of system then a priority scheduler, adding requirements on the tasks to provide estimates on how much work they have yet to do to meet their deadlines. (Things can be simplified if you KNOW that all deadlines will be met, but such a system degrades poorly when that assumption is not met)