Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?
View worked solution
Answer: C;D
To determine which options guarantee a transition from user mode to kernel mode, let us analyze each choice:
- Function Call: A standard user-space function call (e.g., calling a user-defined function) is managed entirely within the user-space stack. It does not involve the operating system kernel and thus remains in user mode.
-
malloc Call:
malloc()is a standard library function (not a system call) that manages a memory pool in user space. If the requested memory can be allocated from this pre-allocated user-space pool,malloc()returns a pointer without invoking the operating system. It only makes a system call (such asbrkormmap) when the pool is exhausted. Therefore, it does not guarantee a transition to kernel mode. - Page Fault: A page fault is a hardware exception that occurs when a program attempts to access a virtual memory page that is not currently mapped to physical RAM. The hardware immediately transfers control to the operating system's page fault handler, which runs in kernel mode. This guarantees a transition to kernel mode.
- System Call: A system call is the programmatic way a user application requests a service from the kernel (e.g., file I/O, process creation). Executing a system call triggers a software interrupt or trap instruction, which immediately transitions the CPU from user mode to kernel mode to execute the service. This guarantees a transition to kernel mode.
Thus, only Page Fault and System Call guarantee a transition to kernel mode.
Free practice · Your answers on this page are not saved.
