This topic is one of the most important bridges between:
Your Program
↓
System Calls
↓
Linux Kernel
↓
Hardware
And later, when we build the Apex compiler, understanding this bridge will help you understand what machine code eventually does.
A system call (syscall) is a request from a user program to the operating system kernel to perform a privileged operation. The kernel is the only component allowed to directly interact with hardware, manage memory, create processes, access files, etc. (Man7)
For example:
use std::fs::File;
fn main() {
let file = File::open("hello.txt");
}
Looks innocent.
But eventually Linux must:
Your Rust code cannot do this directly.
Instead it asks Linux through a syscall.
Suppose:
println!("Hello");