Rust vs. C/C++ for Secure Real-Time PLC/RTU Firmware: A Comparative Study of Timing, Memory Predictability, Security, and Deployment

This paper compares C and Rust for secure real-time PLC/RTU firmware using an equivalent simulated control workload. It examines execution timing, memory-allocation behavior, memory-safety protections, and deployment costs. The results showed that both C and heapless Rust completed every measured control workload within the 1 ms period. Under CPU load, their p99 execution times were almost the same: 42.417 µs for C and 41.878 µs for Rust. Static-pool allocation was also nearly identical, averaging 13.510 ns in C and 13.553 ns in Rust. In contrast, Rust’s global-heap allocation was slower and less predictable, with a 33.510 ns mean and a 3292 ns observed maximum. For security, C programs with buffer overflow, use-after-free, double-free, and data-race bugs were detected using sanitizers. Safe Rust rejected use-after-free, double-free, and data-race examples at compile time, while out-of-bounds access was safely handled using a checked lookup. Rust had a larger host executable size—about 472 KB, compared with 34 KB for C. Overall, the paper finds that heapless Rust can provide similar measured performance and better default memory safety for new PLC/RTU components. However, the experiment ran on macOS rather than real PLC hardware or an RTOS, so it does not prove hard-real-time performance or formal WCET guarantees.

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-08-26
DOI
https://doi.org/10.5281/zenodo.22114023
Primary Topic
Cryptographic Implementations and Security
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Rust vs. C/C++ for Secure Real-Time PLC/RTU Firmware: A Comparative Study of Timing, Memory Predictability, Security, and Deployment

Piyush Shukla
Zenodo (CERN European Organization for Nuclear Research)
Cryptographic Implementations and Security
preprint

Rust vs. C/C++ for Secure Real-Time PLC/RTU Firmware: A Comparative Study of Timing, Memory Predictability, Security, and Deployment

Piyush Shukla
preprint en

Abstract

This paper compares C and Rust for secure real-time PLC/RTU firmware using an equivalent simulated control workload. It examines execution timing, memory-allocation behavior, memory-safety protections, and deployment costs. The results showed that both C and heapless Rust completed every measured control workload within the 1 ms period. Under CPU load, their p99 execution times were almost the same: 42.417 µs for C and 41.878 µs for Rust. Static-pool allocation was also nearly identical, averaging 13.510 ns in C and 13.553 ns in Rust. In contrast, Rust’s global-heap allocation was slower and less predictable, with a 33.510 ns mean and a 3292 ns observed maximum. For security, C programs with buffer overflow, use-after-free, double-free, and data-race bugs were detected using sanitizers. Safe Rust rejected use-after-free, double-free, and data-race examples at compile time, while out-of-bounds access was safely handled using a checked lookup. Rust had a larger host executable size—about 472 KB, compared with 34 KB for C. Overall, the paper finds that heapless Rust can provide similar measured performance and better default memory safety for new PLC/RTU components. However, the experiment ran on macOS rather than real PLC hardware or an RTOS, so it does not prove hard-real-time performance or formal WCET guarantees.

Zenodo (CERN European Organization for Nuclear Research)
Narsee Monjee Institute of Management Studies (IN)
Cryptographic Implementations and Security
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.