A CPU has two modes -- privileged and non-privileged. In order to change the mode from privileged to non-privileged
View worked solution
Answer: C
To understand mode transitions in a CPU, let us look at how the operating system manages execution modes:
- User Mode (Non-privileged) to Kernel Mode (Privileged): This transition occurs when an event requires the operating system's intervention. It is triggered by a hardware interrupt, a software interrupt (trap/system call), or an exception.
- Kernel Mode (Privileged) to User Mode (Non-privileged):
When the operating system finishes its task (e.g., handling a system call or interrupt) and wants to return control to the user program, it must switch the CPU back to non-privileged mode.
- This is done by executing a special instruction (such as
IRETorSYSRET) that restores the program counter and resets the mode bit in the status register to non-privileged. - Since this instruction modifies critical system state (the processor status register), it must be a privileged instruction.
- This instruction is executed directly by the OS and does not generate any interrupt.
- This is done by executing a special instruction (such as
Therefore, changing the mode from privileged to non-privileged requires a privileged instruction that does not generate an interrupt.
Free practice · Your answers on this page are not saved.
