Starvation Timer Definition

This MotoHawk™ block specifies the threshold used by MotoHawk™ to detect task starvation.

Block ID

Starvation Timer Definition


MotoHawk_lib/Extra Development Blocks


Defining Task Starvation

Task starvation refers to the phenomena where a task desires to execute, but it is unable to do so because higher priority threads are executing in preference to the starved task. Task starvation is typically seen as a fault condition because it generally isn't normal for CPU utilization to remain at 100% indefinitely and therefore all tasks should be able to execute. Often task starvation is triggered by software malfunction. For example an executing thread that gets stuck in an infinite loop because of an algorithm failure or data corruption would cause task starvation. In this example the threads with an execution priority lower than the "stuck" thread will be "starved" of execution because the higher priority "stuck" thread will continue to execute in preference to them.

Detecting Task Starvation

MotoHawk™ detects task starvation by assuming CPU utilization will not remain at 100% indefinitely and thus the idle work will execute at some point. Task starvation is said to have occurred if the Starvation Time specified by the Task Starvation Definition block elapses without the idle thread executing.

Implications of Task Starvation

Task starvation is treated as an abnormal condition that will result in a module reset occurring. The Reset Cause block will indicate task starvation as the cause of the reset should this occur.

How to determine what value to use for task starvation

Temporarily set the Starvation Time to a large value and use the Idle Loop Time Get block to measure the maximum observed idle time while the application is executing. The Starvation Time needs to be at least this long to avoid task starvation being detected for what is considered normal operation.

Disabling Task Starvation

Task starvation can be disabled by setting the Starvation Time to zero, which implies an infinite time. This is not recommended for control applications. Control tasks that are starved of execution won't execute their control correctly, but the situation won't trigger the CPU Watchdog reset if task starvation is disabled.

Task starvation requirements can be relaxed when the application installs Slip Detection on its periodic trigger groups. Slip Detection allows periodic trigger group execution to examined for timeliness of execution irrespective of other starvation settings. The following illustrates with an example. Also see using Slip Detection as an Alternate Task Starvation detection mechanism.

Block Parameters

Parameter Field Values Comments/Description
Starvation Timer (ms) Numeric Task starvation will be detected if the idle loop does not execute within this time. A value of zero is treated an infinite and thus disables the detection of task starvation.
Starvation Timer Margin (ms) Numeric The Second Generation Application Monitor uses the margin to determine when the application is approaching the starvation time, but has not exceeded it. The first generation Application Monitor does not use the margin value.