Bird
Raised Fist0

Which component is responsible for switching the CPU from user mode to kernel mode when a system call is invoked?

easy🔍 Pattern Recognition Q11 of Q15
Operating Systems - System Call - Mechanism & Modes (User vs Kernel)
Which component is responsible for switching the CPU from user mode to kernel mode when a system call is invoked?
AThe user-level application itself triggers the mode switch directly
BThe CPU hardware via a software interrupt or trap mechanism
CThe operating system scheduler decides when to switch modes
DThe device driver initiates the mode switch
Step-by-Step Solution
  1. Step 1: Understand system call invocation

    System calls are invoked by user programs to request kernel services. This requires a mode switch from user to kernel mode.
  2. Step 2: Role of CPU hardware

    The CPU provides a mechanism (trap or software interrupt) that safely switches the mode and transfers control to the OS kernel.
  3. Step 3: Why other options are incorrect

    The user-level application itself triggers the mode switch directly is wrong because user applications cannot directly change CPU mode for protection reasons. The operating system scheduler decides when to switch modes is incorrect because the scheduler manages process execution but does not trigger mode switches on system calls. The device driver initiates the mode switch is wrong because device drivers run in kernel mode and do not initiate mode switches from user mode.
  4. Final Answer:

    Option B -> Option B
  5. Quick Check:

    System call -> trap -> CPU switches mode -> kernel handles request [OK]
Quick Trick: CPU hardware trap triggers mode switch on system call
Common Mistakes:
MISTAKES
  • Thinking user code can directly switch CPU mode
  • Confusing scheduler role with mode switching
  • Believing device drivers initiate user-to-kernel transitions
Trap Explanation:
PITFALL
  • Options A and D seem plausible because user code and device drivers are involved in system calls, but only the CPU hardware trap mechanism can safely switch modes. Scheduler involvement is about process management, not mode switching.
Interviewer Note:
CONTEXT
  • Tests candidate's understanding of the fundamental mechanism enabling system calls and privilege separation.
Master "System Call - Mechanism & Modes (User vs Kernel)" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes