• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

Framing

This synthesis compares user mode and kernel mode — the two privilege levels at which code executes in a modern operating system. This separation is the foundation of OS security, stability, and resource management. Without it, every program would have unrestricted access to hardware, memory, and system data, making computer systems catastrophically unsafe.

Structured Comparison

DimensionUser ModeKernel Mode
Privilege levelRestricted (Ring 3)Full (Ring 0)
Hardware accessNone — must use system callsFull — direct access to CPU, memory, devices
Memory accessProcess’s own address space onlyEntire physical memory
Privileged instructionsCannot executeCan execute (HLT, IN/OUT, LGDT, etc.)
Who runs hereApplications (Chrome, VS Code, Spotify)Kernel, device drivers, interrupt handlers
Crash impactAffects only the processCan crash the entire OS
CPU mode bit1 (user)0 (kernel)
Transition mechanismSystem calls / interruptsAutomatic from user mode via traps

Insights Beyond Individual Concepts

The Mode Switch Tax

Every transition between user mode and kernel mode (mode switch) costs 50-200 CPU cycles — roughly 10-40x more than a regular function call. This cost comes from saving/restoring registers, swapping stacks, and validating the transition. This is why performance-sensitive applications batch system calls rather than making them one at a time, and why kernel-bypass technologies (DPDK, SPDK, io_uring) seek to minimize mode switches.

Not All OS Code Runs in Kernel Mode

A common misconception is that “the operating system” runs entirely in kernel mode. In reality, most of what users think of as the OS — the GUI, the terminal, system utilities (ls, ps, grep), the shell, the compiler — runs in user mode. Only the core kernel (scheduler, memory manager, interrupt handlers, device driver core) runs in kernel mode. This means even “OS components” benefit from the safety of user-mode isolation.

The Principle of Least Privilege

The user/kernel mode split is a textbook application of the Principle of Least Privilege: every component gets only the permissions it needs to function. Applications need to compute but not access hardware directly — so they get user mode. The kernel needs full control — so it gets kernel mode. This principle, implemented in hardware, is why your browser can crash without taking down the entire computer.

Connections

  • User Mode — one of the two modes compared
  • Kernel Mode — the other mode compared
  • CPU Privilege Rings — the hardware mechanism that enforces mode separation (Ring 0 and Ring 3)
  • Mode Switching — the process of transitioning between user and kernel mode
  • System Calls — the only way for user mode to request kernel-mode services
  • Kernel — the component that runs in kernel mode
  • Operating System — the OS design is fundamentally shaped by this mode separation
  • Security and Protection — mode separation is the foundation of OS security
  • Monolithic Kernel — in monolithic kernels, more code runs in kernel mode, expanding the trusted computing base