This thesis contributed by Luo Haomin, Chen Linbo, Liu Shi, Li Ding, Zhao Yuyang.
Abstract
With the development of the IoT and embedded systems, the security and performance demands for RTOS are increasing. Traditional C-based RTOS systems face limitations in memory safety and concurrency control, which can lead to issues like buffer overflows and data races. This project is based on RT-Thread and uses the Rust programming language to refactor its kernel, resulting in a new system called RusT-Thread. The system adopts a modular architecture covering core functionalities such as kernel services, process scheduling, memory management, thread communication, and clock control, while fully utilizing Rust’s ownership model and type system to ensure memory and concurrency safety. The project innovatively introduces enhanced multi-level feedback queue scheduling algorithms, interrupt-safe data containers (RTIntrFreeCell), inline assembly, and dynamic-static data separation techniques, optimizing code simplicity and maintainability while ensuring functional compatibility. Through unit testing, integration testing, and performance benchmarking, RusT-Thread demonstrates real-time performance comparable to or even better than RT-Thread in key metrics such as interrupt latency, context switching, and thread creation time. This work not only demonstrates the feasibility and advantages of Rust in system software development but also provides a reference for future designs of secure and reliable embedded RTOS systems.
