System Calls & CPU Execution Modes
Subject: Operating Systems
Transitioning CPU privilege from User Mode (Ring 3) to Kernel Mode (Ring 0).
Concept Summary
Key Revision Rules & Formulas
- User Mode (Ring 3) restricts applications from direct hardware and kernel memory access.
- Kernel Mode (Ring 0) grants full CPU instruction set and direct hardware control.
- System Calls trigger a Software Trap or Hardware Interrupt to safely switch CPU execution mode.
- The OS kernel validates system call parameters before executing privileged code on behalf of user applications.
Common Exam Pitfalls
- 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.
Sample Practice Questions
Question 1: How does the CPU switch from User Mode to Kernel Mode when an application requests a system service?
- By executing a System Call (Interrupt / Trap)
- By calling a normal program function
- By clearing the RAM cache memory
- By restarting the CPU processor
Explanation: A System Call triggers an interrupt or trap that safely switches CPU privilege from User Mode to Kernel Mode.