Concurrency Insights

When using an operating system, the scheduler takes over the aspect of concurrency for developers by switching between different tasks back and forth. This method delivers great prospects for developers, since it abstracts many challenges the bare-metal approach possesses by modular, priority based scheduling and simplifying timing requirements.

In a bachelor thesis with the tile: “Evaluation of Concurrent Task Execution in FreeRTOS on a Cortex M4F Architecture”, Mr. Witte determined for Hilscher concurrency aspects of FreeRTOS on a netX 90 device. This page discusses the thesis' results.


Task Switch Overhead

The central question in Mr. Witte's work was, whether the netX 90 behaves similar to other Cortex M4 platforms when it comes to the generated overhead by FreeRTOS. He defined the Task Switch Overhead (TSO) as “the required time to perform one task switch, which is the transaction time from one task to another”.

Mr. Witte realized that the TSO primarily depends on the used scheduling algorithm and the number of processor registers which are stored on the stack. Therefore, an impact on the TSO has:

  • Cooperative or pre-emptive scheduling?
  • FPU used (the registers S0 — S31 are put into operation and need to be stored)

In his work, he determined the average context switch overhead for FreeRTOS V10.3.1 on a netX 90 platform to:

  1. Cooperative scheduling concept
    1. ~201 clock cycles without FPU utilization
    2. ~268 clock cycles with FPU utilization
  2. Pre-emptive scheduling concept
    1. ~377 clock cycles without FPU utilization
    2. ~444 clock cycles with FPU utilization



From these findings, he derived the “wasted processor capacity” diagram, which declares that with a certain system tick-rate, the task-switch requires a certain amount of processor capacity. This scales up to the point of which the task-switch cannot be processed before another system tick occurs, which puts the system eventually in a freezing state.

Influence of configUSE_NEWLIB_REENTRANT: First observations showed that the switching process of the impure pointer requires additionally ~8 clock cycles per task-switch.