Spinning up an RTOS

November 23, 2025


TL;DR

  • Goal: Spinup an RTOS & Demonstrate Improved Latency Performance

  • System: Ubuntu 24 Pro running on NUC Core i7-8705G

  • Test/Metric: Mean/Max/Std Latency for 1kHz loop

  • Results (µs):

    Base Ubuntu: mean = 38, max = 3864, std = 52

    RT Ubuntu: mean = 3, max = 137, std = 0.7

Story

This week, I worked on spinning up a Real-time Operating System (RTOS) for the first time in my career. The target computer is an Intel NUC Core i7-8705G (8 core) running Ubuntu (Pro) 24.04.3 LTS. I started with Ubuntu Desktop, but switched to Ubuntu Server as part of the debug process.

The main idea is to configure and “tune” the RTOS to have more Deterministic Performance than the default performance of a “normal Operating System”. In particular, we want to run a Control Loop at a Target Frequency, and we want minimal Latency (deviation) from this Target Frequency. Smaller, more consistent Latency = better Control System performance.

Results

Figure 1 shows results from a 1kHz Latency Test comparing the performance of Base Ubuntu (blue) and Tuned Real-Time Ubuntu (red). Notice that the Tuned RT system displays significantly less Latency deviation (0.7 vs 52 µs) and significantly lower Mean Latency (3 vs 38 µs). This is reflected in the corresponding Histogram, shown in Figure 2.

One interesting aspect of this endeavor is that nearly all of my initial attempts at tuning the RTOS made the system perform worse. As I got closer to a “first success”, I realized that most of the debug steps were in the spirit of “isolating the target CPU”. Figure 3 shows an extended run of the Tuned RT system, and in that data there are “spikes” that happen almost regularly. My current hypothesis is that these spikes correspond to kernel processes that I haven’t (yet) isolated the target CPU (CPU2) away from.

Useful References