TSGL-Rust: Teaching Concurrency Through Compile-Time Enforcement via Rust-Based Visualization of Classical Synchronization Problems
DOI:
https://doi.org/10.31436/iiumej.v27i2.4361Keywords:
Concurrent programming, Rust, compile-time safety, visualization, operating systems educationAbstract
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.
ABSTRAK: Pengaturcaraan serentak kekal sebagai cabaran utama dalam pendidikan sarjana muda sains komputer dan kejuruteraan, kerana mod kegagalannya sukar dicari dan difahami secara sistematik. Keadaan perlumbaan dan kebuntuan lazimnya hanya muncul di bawah jalinan pelaksanaan jalur tertentu, sekaligus menyebabkan pelajar perlu menyelaras kod yang kelihatan betul dengan tingkah laku masa jalan yang tidak menentu. Pendekatan pengajaran terdahulu, seperti Koleksi Grafik Jalur-Selamat (TSGL), menangani isu ini melalui visualisasi masa nyata, tetapi bergantung pada bahasa yang tidak menguatkuasa capaian selamat pada keadaan berkongsi. Pemisahan antara pemerhatian dan penguatkuasaan ini mewujudkan jurang antara bagaimana ralat serentak dikesan dan bagaimana ia dicegah. Kajian ini membentangkan TSGL-Rust, iaitu pelaksanaan semula TSGL berasaskan Rust yang mengintegrasi jaminan keselamatan masa kompilasi dan visualisasi masa jalan. Melalui rangka kerja e-GUI/e-rangka, sistem ini menjana semula tiga masalah menyegerakan kanonik, iaitu Pengeluar-Pengguna, Penulis-Pembaca, dan Dining Philosophers, sambil mengalihkan sebahagian kelas ralat daripada masa jalan kepada peringkat kompilasi melalui model pemilikan dan pemeriksa pinjaman Rust. Seni bina sistem ini secara sengaja memisahkan logik serentak daripada paparan alur silang, dengan jalur pekerja dipisahkan daripada gelung peparan utama eGUI. Kajian ini dibentangkan sebagai penerangan sistem dan alat: tumpuan diberi pada reka bentuk seni bina, pemetaan primitif TSGL C++ pada konstruk Rust, corak komunikasi berasaskan saluran, dan keupayaan instruksional yang berpunca daripada reka bentuk ini. Sumbangan utama terletak pada sistem ini sendiri dan pada sempadan yang dijelaskan antara pencegahan keadaan perlumbaan dan ralat logik seperti kebuntuan, dan bukan pada sebarang dakwaan terhadap pencapaian pembelajaran yang diukur.
Downloads
References
A. N. Kumar et al., "Computer science curricula 2023," ed: ACM, 2024.
C. Sadowski, E. Söderberg, L. Church, M. Sipko, and A. Bacchelli, "Modern code review: A case study at Google," in Proceedings of the 40th International Conference on Software Engineering: Software Engineering in Practice, 2018, pp. 181-190.
J. C. Adams et al., "TSGL: A tool for visualizing multithreaded behavior," Journal of Parallel and Distributed Computing, vol. 118, pp. 233-246, 2018.
S. Klabnik and C. Nichols, The Rust programming language. No Starch Press, 2023.
H.-H. Dang, J.-H. Jourdan, J.-O. Kaiser, and D. Dreyer, "RustBelt meets relaxed memory," Proceedings of the ACM on Programming Languages, vol. 4, no. POPL, pp. 1-29, 2019.
J. C. Castro-Alonso, P. Ayres, and J. Sweller, "Instructional visualizations, cognitive load theory, and visuospatial processing," in Visuospatial processing for education in health and natural sciences: Springer, 2019, pp. 111-143.
R. Duran, A. Zavgorodniaia, and J. Sorva, "Cognitive load theory in computing education research: A review," ACM Transactions on Computing Education (TOCE), vol. 22, no. 4, pp. 1-27, 2022.
R. Jung, J.-H. Jourdan, R. Krebbers, and D. Dreyer, "Safe systems programming in Rust," Communications of the ACM, vol. 64, no. 4, pp. 144-152, 2021.
S. Panter and N. Eisty, "Rusty Linux: Advances in Rust for Linux kernel development," in Proceedings of the 18th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, 2024, pp. 496-502.
W. House, "Back to the building blocks: A path toward secure and measurable software," Office of the National Cyber Director, Executive Office of the President, 2024.
E. Ernerfeldt. "egui: an easy-to-use GUI in pure Rust." https://github.com/emilk/egui (accessed 18 April 2026).
W. Crichton, G. Gray, and S. Krishnamurthi, "A grounded conceptual model for ownership types in rust," Proceedings of the ACM on Programming Languages, vol. 7, no. OOPSLA2, pp. 1224-1252, 2023.
K. R. C. Siek, "An Undergraduate Computer Systems Curriculum Using Rust," Virginia Tech, 2025.
F. Strömbäck, L. Mannila, and M. Kamkar, "Pilot study of progvis: A visualization tool for object graphs and concurrency via shared memory," in Proceedings of the 24th Australasian Computing Education Conference, 2022, pp. 123-132.
F. Strömbäck, L. Mannila, and M. Kamkar, "A weak memory model in Progvis: Verification and improved accuracy of visualizations of concurrent programs to aid student learning," in Proceedings of the 22nd Koli Calling International Conference on Computing Education Research, 2022, pp. 1-12.
F. Strömbäck, L. Mannila, and M. Kamkar, "Using Model-Checking and Peer-Grading to Provide Automated Feedback to Concurrency Exercises in Progvis," in Proceedings of the 25th Australasian Computing Education Conference, 2023, pp. 11-20.
W. Stallings, Operating Systems: Internals and Design Principles. Pearson Education Limited, 2018.
A. S. Tanenbaum, "Modern Operating Systems, 4th Edition," ed: Pearson, 2015.
J. C. Adams, E. R. Koning, and C. D. Hazlett, "Visualizing classic synchronization problems: Dining philosophers, producers-consumers, and readers-writers," in Proceedings of the 50th ACM Technical Symposium on Computer Science Education, 2019, pp. 934-940.
P. Yosifovich, M. E. Russinovich, A. Ionescu, and D. A. Solomon, Windows Internals, Part 1: System architecture, processes, threads, memory management, and more, 7th Edition. Microsoft Press, Pearson, 2017.
A. Allievi, M. E. Russinovich, A. Ionescu, and D. A. Solomon, Windows Internals, Part 2, 7th Edition. Microsoft Press, Pearson, 2021.
K. N. Billimoria, Linux Kernel Programming: A comprehensive and practical guide to kernel internals, writing modules, and kernel synchronization. Packt Publishing Ltd, 2024.
J. Sweller, "Cognitive load theory and educational technology," Educational technology research and development, vol. 68, no. 1, pp. 1-16, 2020.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 IIUM Press

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.








