Question

Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?

Choose every correct option
Official answer and solution
Official answer
C and D
From
Official GATE 2023 answer key

Solution

Identify the events that directly trigger a hardware trap or CPU privilege mode switch.

  1. Function Call: A standard user-space subroutine call (call instruction) only modifies the program counter and stack in user space; it does not switch CPU privilege mode.
  2. malloc Call: malloc is a C standard library function that allocates memory from an already allocated heap arena in user space. It only invokes brk or mmap when the arena needs expansion, so a malloc call does not guarantee a kernel mode transition.
  3. Page Fault: When a memory reference cannot be translated by the MMU, the hardware triggers a page fault exception, which unconditionally causes the CPU hardware to switch to kernel mode to run the OS page fault handler. (Guaranteed)
  4. System Call: Executed via a dedicated trap instruction (syscall, sysenter, int 0x80), which intentionally triggers a hardware transition from user mode to kernel mode. (Guaranteed)
Final answer

Options (C, D)

Common trap

Assuming malloc is a system call rather than a user-space library function.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2023 Computer Science and Information Technology (CS)
Question
23 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.