Operating Systems

System Calls & CPU Execution Modes

System Calls & CPU Execution Modes

High-Yield Revision Hub

Master System Calls & CPU Execution Modes

Transitioning CPU privilege from User Mode (Ring 3) to Kernel Mode (Ring 0).

Concept Breakdown

Detailed technical explanation

Modern CPUs use hardware-enforced protection rings to prevent user applications from corrupting system memory or hardware devices. When an application needs to read a file, send network packets, or allocate memory, it cannot execute these actions directly. Instead, it triggers a System Call trap, switching the CPU to Kernel Mode (Ring 0). The kernel processes the request and switches execution back to User Mode.

Key Revision Rules

Essential formulas and core points to memorize

  • 1User Mode (Ring 3) restricts applications from direct hardware and kernel memory access.
  • 2Kernel Mode (Ring 0) grants full CPU instruction set and direct hardware control.
  • 3System Calls trigger a Software Trap or Hardware Interrupt to safely switch CPU execution mode.
  • 4The OS kernel validates system call parameters before executing privileged code on behalf of user applications.

Common Exam Mistakes

Where students frequently lose marks

Confusing function calls with system calls: Normal function calls (like C `printf`) run in User Mode; underlying `write()` system calls trap into Kernel Mode.
Thinking Kernel Mode runs continuously: The CPU enters Kernel Mode only when responding to interrupts, traps, or system calls.

Topic Quiz Practice

1 of 1
Question 1

How does the CPU switch from User Mode to Kernel Mode when an application requests a system service?