Bird
Raised Fist0

Trace the sequence of events when a user program invokes a system call to read a file. Which step happens immediately after the CPU switches to kernel mode?

easy🧠🧾 Concept Trace Q12 of Q15
Operating Systems - System Call - Mechanism & Modes (User vs Kernel)
Trace the sequence of events when a user program invokes a system call to read a file. Which step happens immediately after the CPU switches to kernel mode?
AThe kernel verifies the system call number and arguments
BThe hardware raises an interrupt to the device
CThe user program resumes execution in user mode
DThe kernel copies data directly to the user buffer without validation
Step-by-Step Solution
  1. Step 1: User program issues system call

    The user program executes a special instruction causing a trap to kernel mode.
  2. Step 2: CPU switches to kernel mode

    Control transfers to the OS kernel with elevated privileges.
  3. Step 3: Kernel validates system call

    The kernel inspects the system call number and arguments to ensure they are valid and safe.
  4. Step 4: Why other options are incorrect

    The kernel copies data directly to the user buffer without validation is unsafe; kernel must validate before copying data. The user program resumes execution in user mode happens after system call completion, not immediately after mode switch. The hardware raises an interrupt to the device is unrelated here; hardware interrupts occur asynchronously, not immediately after mode switch.
  5. Final Answer:

    Option A -> Option A
  6. Quick Check:

    System call trap -> kernel mode -> validate call -> execute service [OK]
Quick Trick: Kernel validates system call immediately after mode switch
Common Mistakes:
MISTAKES
  • Assuming kernel copies data before validation
  • Confusing interrupt handling with system call flow
  • Thinking user mode resumes immediately after trap
Trap Explanation:
PITFALL
  • Option A is tempting because copying data is part of read, but it must happen after validation. Option D confuses hardware interrupts with software traps. Option C is a common off-by-one timing error in understanding system call flow.
Interviewer Note:
CONTEXT
  • Checks candidate's grasp of the internal sequence during system call handling.
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