Question
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?
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.
- Function Call: A standard user-space subroutine call (
callinstruction) only modifies the program counter and stack in user space; it does not switch CPU privilege mode. - malloc Call:
mallocis a C standard library function that allocates memory from an already allocated heap arena in user space. It only invokesbrkormmapwhen the arena needs expansion, so amalloccall does not guarantee a kernel mode transition. - 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)
- 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.