Safe System Programming

This is the home page for the "Safe System Programming" course. Here, you will find (in a badly-organised form) all the material, slides, and information needed to attend the course

Lessons:

Ideas about Possible Projects for the Exam

Some projects are simpler than others; if you decide to work on a project, please contact me first.

Links and other teaching material:

Here is a paper comparing the performance of user-space device drivers written in different languages.

In order to better understand Rust and some aspects of its design, it is important to know some concepts about programming languages (not directly related to Rust or to safe programming languages, but applicable to many different programming languages). Here is a simple document (in Italian) defining some of these important concepts.

On the internet it is possible to find a huge amount of tutorial showing how to write kernels, hypervisors or bare-metal applications in Rust. For example, look at Philipp Oppermann's blog (note: in the example showed during the course, Rust is used to code a library that is linked to some startup code written in Assembly; in the current version of the blog, Rust is used to write the main application, using a "bootloader" crate. The blog uses cargo --- in particular, cargo xbuild --- to cross-compile bare-metal Rust applications). Other useful links can be toyos-rs and eduOS-rs.

Interesting news: QEMU developers are thinking about moving QEMU to Rust.

Code examples:

Some examples about ownership and move semantics in Rust (do not care about syntax, Box, and new yet):

An example about a simple function in Rust (notice how the return value is passed).

An example about using boolean predicates (in an "if" expression).

Some examples about the Rust predefined data types, in particular compound types:

An example about parsing a string, showing that the type inference mechanism here needs some help...

Some examples about Rust data types that can be accessed through pattern matching:

Some examples about methods:

Some examples about traits and generics:

And, last but not least, some examples about smart pointers:

Very simple kernel written in Rust

Examples about functions and closures:

Some other examples, about threads:

Coding exercizes: