주요 콘텐츠

Task Overruns and Countermeasures

With finite processing resources available in a system, an execution instance of a task might not be able to complete before the start of the next task instance. This task overrun results in the start of the next instance of the task execution to be delayed. As a result, the next task must catch-up to avoid another overrun. This diagram shows a simplified execution of two tasks: a high-priority event-driven task and a low priority timer-driven task.

Due to the long execution time of the event-driven task, the first execution instance of the timer-driven task overruns into the start of the next execution instance. This overrun puts the second execution instance into catch-up mode.

When tasks overrun repeatedly, an execution backlog can develop in the application, potentially breaking the system. These sections discuss typical countermeasures to either reduce the chance of task overruns or handle situations when tasks overrun, preventing an execution backlog.

Increase of Task Execution Interval

For timer-driven tasks, reduce the chance of overruns by providing the task with more execution time. Increase available execution time by decreasing the task rate, which is equivalent to increasing the time between task execution instances. This extra time provides each task execution instance a better chance of running to completion, even in the presence of other tasks. The rate of a timer-driven task can be adjusted in the Task Manager block by setting the Period parameter.

Reduction of the task execution interval cannot be guaranteed in all cases. Some of these cases include:

  • For event-driven tasks, multiple events can occur at the same time, depending on the priority of the event-driven task. This case forces other tasks to overrun due to lack of resources.

  • Real-time requirements where a task, timer or event driven, must respond to the latest event trigger signal and new data regardless of whether previous task instances completed. This case fixes the task execution interval to a value determined by the design requirements.

In these cases, distributing tasks across multiple processor cores or allowing tasks to drop can be advantageous depending on the design requirements.

Distribution of Tasks Across Multiple Processor Cores

Most modern embedded processors provide multiple cores where tasks can be executed. By distributing tasks across these multiple processor cores, tasks can run simultaneously without directly competing for processing resources and reducing the chance of task overruns. In SoC Blockset™, a task can be set to run on a specific processor core in the Task Manager block by setting the Core parameter to the core number. For more information on the selection, execution, and visualization of tasks on multiple cores, see Multicore Execution and Core Visualization.

See Also

Topics