The Rust Runtime
(undone chapter)
Hopefully, you've read this intro to runtimes.
Unlike the JAVA runtime and JS runtime, the Rust runtime is not an application that runs independent of the user-program. The Rust runtime is a set of library files that get statically compiled together with your Rust code. Rust runtime is not an independent application, it is a dependency that gets linked and compiled together with the program that you are writing.
The Rust runtime follows the third meaning. ie The Rust runtime is the startup code that gets executed in preparation for the call to the main
function.
Note from the author...call or content-contributions
I do not undertand exactly what the Rust-runtime on unix does.
Here is the source code for the Runtime : link to page
Here is a page that tries to explain what the runtime does : The Rust Reference book: The Rust runtime
I am currently assuming that the functions of the Runtime are...
- Setting up threading and creating a new special thread for 'main'
- Inserting
clean_up
code. This is code that MAY get executed at the end of themain
function. It clears up memory. - Setting up backtracing functions
- Setting up panicking behavior, especially
panic-unwinding
. - Availing Heap handling wrapper functions
- OS-to-process Signal handling
- Stack management (eg no overflows)
- Thread management (eg ensure sharing rules a)
Silver lining
Since the Rust runtime is std
-dependent, we are better off spending our time understanding alternative runtimes that ...
- are
no-std
compliant - implement protection features that may be missing from the C-runtime
Our main focus will now be on riscv-rt
, a riscv-runtime built by the embedded-rust team.
link pointing to the chapter covering riscv-rt
(undone: this chapter is wanting)