Real-Time Linux vs. RTOS for industrial networking

Using RTOS in Industrial Networking

Real-Time Operating Systems (RTOS) play a critical role in industrial networking by ensuring tasks are processed within strict time constraints. Such systems prioritize high-priority tasks, ensuring deterministic and timely responses, which is vital in automated environments where delays can lead to inefficiencies or even hazardous situations. Industrial applications include automotive, robotics and aviation among many others. An RTOS (Including FreeRTOS and RT-Kernel) is designed to handle real-time data and control tasks by managing the system’s hardware resources and scheduling tasks based on their priority levels, ensuring that high-priority tasks can interrupt lower-priority tasks. This architecture is essential for maintaining the operational integrity of time-sensitive industrial processes.

Examining the Real-Time Linux Kernel

The Linux kernel is widely used for its flexibility and stability. However, it is not a real-time system by default. By applying the RT_PREEMPT patch, we can modify the kernel to prioritize real-time tasks effectively. This patched version of the Linux kernel can preempt less critical processes in favor of time-sensitive ones. We will in this article do a comparison between an real-time OS (RT-Kernel) and a linux kernel with RT-PREEMPT patch. The hardware is LAN9662 from Microchip.

For industrial applications running Linux on Microchip LAN9662 hardware, the RT-PREEMPT patch is key to achieving the necessary real-time capabilities. It involves kernel adjustments for interrupt handling and process scheduling, ensuring time-critical tasks are managed appropriately.

Performance Metrics: Latency and Throughput under Load

In evaluating the real-time performance of the Linux kernel with the RT_PREEMPT patch versus a standard kernel and an RT-Kernel on the LAN9662 hardware, latency and throughput are the primary metrics. The cyclictest tool was used to measure the timing behavior under network load, induced by the iperf3 tool to simulate heavy data traffic. The results were as follows:

Standard Linux

    The standard Linux kernel managed an average network throughput of 250 Mbits/s under load, but several test samples exceeded a delay of more than 500 microseconds (µs), which could compromise real-time performance.


      Real-Time Linux

      With RT_PREEMPT, the Linux kernel showed a reduced average throughput of 170 Mbits/s under load. However, the latency was significantly improved, with the RT_PREEMPT kernel keeping delays below 150 µs.



        RT-Kernel, while only achieving an average of 65 Mbits/s under load, had the least impact on latencies, demonstrating the expected behavior of an RTOS where network throughput is less prioritized in favor of task execution. Note the time scale, delays were in the nanoseconds range. 

        In the loaded case an average of 65 Mbits was achieved, while the bandwidth achieved without any test running was 140 Mbits. This will skew the results somewhat since the interrupt load on the RTOS tests are likely a bit less. As expected however, the loading over network, has very little impact on actual latencies.

        Real-World Implications of RTOS in Industrial Networks

        The real-world implications of these findings are significant for industrial networking. The RT_PREEMPT patch’s ability to bound and maintain lower latency makes it suitable for real-time applications, despite the trade-off in network performance. On the other hand, the RT-Kernel’s lower network throughput underlines the inherent balance that must be struck between real-time task prioritization and overall network performance. In scenarios where sub-millisecond response times are required, the RT_PREEMPT kernel presents a viable solution, albeit with the understanding that it may incur a throughput penalty. These results are crucial when designing and implementing systems where the predictability and timeliness of task execution are non-negotiable.

        Looking for a reliable network enabled RTOS?