Accounting for overheads

System overheads

When developing real applications, system overheads may not be always negligible.

In such cases it may be necessary to consider the impact of:

  • The processing cost of internal mechanisms (e.g. tick handler).

  • The overhead due to context switching.

  • Interrupt Service Routines.

System tick cost

Evaluating the computational cost of the system tick.

  • The service to the system tick uses CPU time (overhead), which is taken from the tasks’ execution.

  • It is the highest priority activity on the system and can be modeled by a periodic task.

  • The respective overhead (σ) may have a substantial impact on the system, as it is a part of the CPU availability that is not available to the application tasks.

Evaluating the computational cost of the system tick.

  • Can be measured either directly or via the timed execution of a long function, executed with and without tick interrupts (period Ttick) and measuring the difference on the execution times.

  • In this case the average value for σ is as follows:

Context switch costs

Evaluating the cost of context switches.

  • Context switches also require CPU time to save and restore the tasks’ context.

  • In this case, the average value for δ is:

  • A simple (but pessimistic) way of taking into account the overhead due to context switching (δ) consists in adding that time to the execution time of the tasks. This way it is taken into account not only the context switching overhead due to the task itself as well as the one relative to all context switches that may occur.

  • Simple but pessimistic, as the overhead is take into account twice.

Cost of ISR’s

Impact of Interrupt Service Routines.

  • Generally, the Interrupt Service Routines (ISR) execute with an higher priority level than all other system tasks.

  • Therefore, on a fixed priority system, the respective impact can be taken directly into account by including these ISR as tasks in the schedulability analysis.

  • In systems with dynamic priorities the situation is much more complex (e.g. how to assign deadlines?). In these cases it is usually considered that the time windows in which such ISR execute are not available for normal tasks execution. This can be taken into account in the CPU load analysis.

Last updated