operating-systems hardware

Definition

Execution Mode

An execution mode (or processor mode) is a hardware-enforced state of the central processing unit that determines the privilege level of the currently executing code. It dictates which instructions can be executed and which memory regions can be accessed.

Most modern architectures support at least two modes to ensure system stability and security: User Mode and Kernel Mode.

Mechanism

The current execution mode is typically stored as one or more bits in the Program Status Word (PSW).

Functionality

Execution modes are fundamental to the operating system’s ability to act as a resource manager:

  • Protection: Prevents user-level processes from executing sensitive instructions (e.g., clearing memory, halting the CPU) that could crash the system.
  • Isolation: Ensures that a failure in a user application does not affect the integrity of the kernel or other processes.
  • Resource Control: Only code running in a privileged mode can modify OS Control Structures or access hardware I/O ports directly.

Transitions between modes are strictly controlled by the hardware and occur through System Calls, interrupts, or traps.