Safe Systems Programming in Rust
| Kód | Zakončení | Kredity (ECTS) | Rozsah | Jazyk výuky |
|---|---|---|---|---|
| FITE-REZ | Z,ZK | 5 | 2P+1C | anglicky |
- Garant předmětu:
- Filip Křikava
- Přednášející:
- Pierre Donat-Bouillud, Filip Křikava
- Cvičící:
- Matej Almáši, Filip Křikava, Dávid Marek Manca
- Předmět zajišťuje:
- katedra teoretické informatiky
- Anotace:
-
Systems programming requires efficient, predictable, and safe code. Rust addresses common memory-safety and concurrency errors through an expressive, statically checked type system, while providing fine-grained control over performance.
The course begins with Rust fundamentals, focusing on how its type system enables memory safety without garbage collection and supports zero-cost abstractions. We explore memory management, type-safe error handling, polymorphism, and techniques for building reliable and efficient software.
Next, we focus on concurrent, parallel, and asynchronous programming, examining how Rust prevents data races at compile time, how different concurrency models work, and where Rust's safety guarantees have limitations.
Finally, we introduce unsafe Rust and interoperability with C and C++ exploring how to maintain safety when the compiler can no longer enforce it.
During the semester students will work on two small projects.
- Požadavky:
-
Start requirements:
Knowledge of C and C++ at the level of PA1/PA2.
- Osnova přednášek:
-
L1. Memory and concurrency in systems programming
L2. Ownership and borrowing
L3. Lifetimes
L4. Data types, collections, and error handling
L5. Traits and generics
L6. Smart pointers, I/O, and macros
L7. Closures and iterators
L8. Threads and thread safety
L9. Atomics, parallelism and memory ordering
L10. Asynchronous programming: models and futures
L11. Asynchronous programming: runtimes
L12. Unsafe Rust and FFI
L13. Backup (a guest lecture or catch-up or a lecture on no-std Rust)
- Osnova cvičení:
-
The six labs are in class, on computers for hand-on coding sessions, possibly AI assisted, not AI prompted. Before each lab, students make sure they are familiar with the specified chapters of the recommended literature and work through quizzes based on those chapters. The content of the lab will then be a series of exercises related to that content. Students terminating early can then follow working on semestral projects.
Labs must be scheduled after lectures.
Lab 1:
Rust basics and tools, modules, tests
Reading: Brown Ch 13
Students install and configure the toolchain and the editor support. Introduction to cargo and series of basic Rust exercises, including modules and tests.
Lab 2:
Ownership, lifetimes, data types, and errors
Reading: Brown Ch 4, 5, 6, 8.18.2, 9
Students correct programs that the borrow checker rejects. For each program, they decide if the program was unsafe and why, or if it was safe but outside the limits of the checker. Practice using lifetimes.
Lab 3:
Traits, generics, I/O, smart pointers
Reading: Brown Ch 7, 10, 11, 15.1, 18.2; Ch 12 (optional)
Students write a command-line utility, and furthermore:
learn static and dynamic dispatch,
work with I/O in Rust,
utilize Traits to properly define code behavior,
work with smart pointers, such as Box.
Lab 4:
Threads and synchronization
Reading: Brown Ch 13, 15, 16
Students exercise tasks in parallelism and synchronizing threads, including focus on data race safety in Rust.
Lab 5:
Async in practice
Reading: Brown Ch 17; Ch 21 (optional)
Students will dive into the following topics:
exercises on async,
async executors, tokio,
working with async functions,
'static lifetime requirements,
smart pointer applications in async context.
Lab 6:
Unsafe Rust and FFI
Reading: Brown Ch 20.1 + some interesting part from the unsafe rust book?
The final lab will be focused on low-level operations with raw pointers, calling C/C++ code - interacting with a library, using embassy and writing low level hardware code and examples in practice
- Cíle studia:
-
The objective of this course is to understand the challenges of systems programming, particularly the memory-safety and concurrency errors that can lead to crashes, undefined behavior, and security vulnerabilities. We examine why these problems arise, how traditional systems programming languages address them, and how language design and type systems can prevent many of them without sacrificing performance. The course focuses on safe systems programming, using Rust as a practical vehicle to explore its principles. Students will learn how Rust's safety guarantees work, what their limitations are, and how to write efficient, reliable systems software with predictable performance.
By the end of the course, students will be able to tell when rewrite it in Rust is the right answer and when it isnt.
- Studijní materiály:
-
Main resource is Programming in Rust, Brown Edition (https://rust-book.cs.brown.edu/)
Additional resources include:
- The Rust Programming Language (ISBN: 1718504446)
- Rust Atomics and Locks (ISBN: 9781098119447)
- Programming Rust, 2nd revised edition (ISBN: 9781492052586)
- Poznámka:
-
Information about the course and courseware are available at https://courses.fit.cvut.cz/FITE-SPR
- Další informace:
- https://courses.fit.cvut.cz/FITE-REZ
- Rozvrh na zimní semestr 2026/2027:
- Rozvrh není připraven
- Rozvrh na letní semestr 2026/2027:
- Rozvrh není připraven
- Předmět je součástí následujících studijních plánů:
-
- Bc. specializace Informační bezpečnost, 2021 (volitelný předmět)
- Bc. specializace Manažerská informatika, 2021 (volitelný předmět)
- Bc. specializace Počítačová grafika, 2021 (volitelný předmět)
- Bc. specializace Počítačové inženýrství, 2021 (volitelný předmět)
- Bc. program, pro fázi studia bez specializace, 2021 (volitelný předmět)
- Bachelor Specialization Computer Engineering, 2021 (volitelný předmět)
- Bachelor Specialization, Information Security, 2021 (volitelný předmět)
- Bc. specializace Webové inženýrství, 2021 (volitelný předmět)
- Bc. specializace Umělá inteligence, 2021 (volitelný předmět)
- Bc. specializace Teoretická informatika, 2021 (volitelný předmět)
- Bc. specializace Softwarové inženýrství, 2021 (volitelný předmět)
- Bc. specializace Počítačové systémy a virtualizace, 2021 (volitelný předmět)
- Bachelor Specialization, Software Engineering, 2021 (volitelný předmět)
- Bachelor Specialization, Computer Science, 2021 (volitelný předmět)
- Bc. specializace Počítačové sítě a Internet, 2021 (volitelný předmět)
- Bachelor Specialization, Computer Networks and Internet, 2021 (volitelný předmět)
- Study plan for Ukrainian refugees (volitelný předmět)
- Bc. specializace Informační bezpečnost, 2024 (volitelný předmět)
- Bc. program, pro fázi studia bez specializace, 2024 (volitelný předmět)
- Bc. specializace Manažerská informatika, 2024 (volitelný předmět)
- Bc. specializace Počítačová grafika, 2024 (volitelný předmět)
- Bc. specializace Softwarové inženýrství, 2024 (volitelný předmět)
- Bc. specializace Webové inženýrství, 2024 (volitelný předmět)
- Bc. specializace Počítačové sítě a Internet, 2024 (volitelný předmět)
- Bc. specializace Počítačové inženýrství, 2024 (volitelný předmět)
- Bc. specializace Počítačové systémy a virtualizace, 2024 (volitelný předmět)
- Bc. specializace Umělá inteligence, 2024 (volitelný předmět)
- Bc. specializace Teoretická informatika, 2024 (volitelný předmět)
- Bachelor Specialization, Computer Engineering, Version 2024 (volitelný předmět)
- Učitelství informatiky pro střední školy (volitelný předmět)
- Bc. specializace Počítačová grafika s vynecháním BI-SVZ (volitelný předmět)
- Kvantová informatika (volitelný předmět)
- Mgr. program Aplikovaná informatika (kód ANI) pro fázi studia bez specializace (volitelný předmět)
- Mgr. specializace Embedded systémy (volitelný předmět)
- Mgr. specializace Manažerská informatika, 2026 (volitelný předmět)
- Mgr. specializace Softwarové inženýrství, program ANI (volitelný předmět)
- Mgr. specializace Webové inženýrství (volitelný předmět)
- Mgr. specializace Visual computing a Game design (volitelný předmět)
- Master specialization Software engineering, program ANI (volitelný předmět)
- Master specialization Embedded systems (volitelný předmět)
- Master program ANIE for the phase of study without specialisation (volitelný předmět)
- Quantum Informatics (volitelný předmět)
- Mgr. specializace Počítačová bezpečnost, 2026 (volitelný předmět)
- Mgr. specializace Počítačové systémy a sítě, 2026 (volitelný předmět)
- Mgr. specializace Teoretická informatika, 2026 (volitelný předmět)
- Mgr. specializace Programovací jazyky, 2026 (volitelný předmět)
- Mgr. specializace Umělá inteligence, 2026 (volitelný předmět)
- Master specialization Computer Security, Version 2026 (volitelný předmět)
- Mgr. program, pro fázi studia bez specializace, ver. pro roky 2026 a vyšší (volitelný předmět)
- Master programme, for the phase of study without specialisation, ver. for 2026 and higher (volitelný předmět)
- Master specialization Computer Systems and Networks, in English, 2026 (volitelný předmět)
- Master specialization Computer Science, in English, 2026 (volitelný předmět)
- Master specialization Programming Languages, in English, 2026 (volitelný předmět)