Operating Systems
System Calls & Kernel Mode
Why applications cannot touch hardware directly, the user/kernel boundary, and what a system call costs.
The question this module answers · Why can’t my program just write to the disk itself?
System Calls
▶ interactive
An application cannot read a disk, send a packet or create a process on its own; it deposits a request number and arguments in registers, executes a trap instruction, and the kernel does it — a few hundred nanoseconds per crossing, which is why batching interfaces exist.
User Mode vs Kernel Mode
▶ interactive
The CPU runs in one of two privilege levels; user mode cannot touch devices, page tables or other processes, and the only ways into kernel mode are a trap, an interrupt or an exception — which is why a segfault is a fault delivered to you as a signal, not a crash of the machine.