IIUM Repository

TSGL-Rust: teaching concurrency through compile-time enforcement via rust-based visualization of classical synchronization problems

Gunawan, Teddy Surya (2026) TSGL-Rust: teaching concurrency through compile-time enforcement via rust-based visualization of classical synchronization problems. IIUM Engineering Journal, 27 (2). pp. 320-339. ISSN 1511-788X E-ISSN 2289-7860

[img]
Preview
PDF - Published Version
Download (1MB) | Preview
[img]
Preview
PDF - Supplemental Material
Download (139kB) | Preview

Abstract

Concurrent programming remains a persistent challenge in undergraduate computer science and engineering education, largely because its failure modes are difficult to observe and reason about. Race conditions and deadlocks often emerge only under specific thread interleavings, leaving students to reconcile correct-looking code with unpredictable runtime behavior. Prior instructional approaches, such as the Thread-Safe Graphics Library (TSGL), address this issue by enabling real-time visualization, but they rely on languages that do not enforce safe access to shared state. This separation between observation and enforcement leaves a gap between how concurrency errors are detected and how they are prevented. This paper presents TSGL-Rust, a Rust-based reimplementation of classical TSGL visualizations that integrates compile-time safety guarantees with runtime visualization. Implemented using the egui/eframe framework, the system reproduces three canonical synchronization problems, namely Producer–Consumer, Reader–Writer, and Dining Philosophers, while shifting certain classes of errors from runtime to compilation through Rust's ownership model and borrow checker. The architecture deliberately separates concurrency logic from rendering through a crossbeam channel, decoupling worker threads from the egui main-thread render loop. This paper is presented as a system and tool description: it focuses on architectural design, the mapping from C++ TSGL primitives to Rust constructs, the channel-based communication pattern, and the instructional affordances that follow from these design choices. The contribution lies in the system itself and in the boundary it makes visible between data-race prevention and logical errors, such as deadlock, rather than in any claim about measured learning gains.

Item Type: Article (Journal)
Uncontrolled Keywords: Concurrent programming, Rust, compile-time safety, visualization, operating systems education
Subjects: T Technology > TK Electrical engineering. Electronics Nuclear engineering > TK7800 Electronics. Computer engineering. Computer hardware. Photoelectronic devices > TK7885 Computer engineering
Kulliyyahs/Centres/Divisions/Institutes (Can select more than one option. Press CONTROL button): Kulliyyah of Engineering > Department of Electrical and Computer Engineering
Kulliyyah of Engineering
Depositing User: Prof. Dr. Teddy Surya Gunawan
Date Deposited: 20 May 2026 09:32
Last Modified: 20 May 2026 09:32
Queue Number: 2026-05-Q3463
URI: http://irep.iium.edu.my/id/eprint/129073

Actions (login required)

View Item View Item