OS & Hardware
What is it called when a guest OS executes a privileged instruction, control passes to the hypervisor, and the hypervisor reproduces the instruction's effect on its behalf?
- ATrap-and-emulate
- BCopy-on-write
- CDemand paging
Show answer and explanation
Answer: A. Trap-and-emulate
A guest OS executes privileged instructions believing it controls the hardware, but it actually runs in a lower-privilege mode, so an exception (trap) occurs. The hypervisor catches it, reproduces (emulates) the instruction's effect so the result is correct for that virtual machine, and returns to the guest. CPU virtualization support makes these transitions fast and reliable. Copy-on-write and demand paging are memory-management techniques.
- A. Correct. Privileged instructions are trapped and emulated by the hypervisor.
- B. Copy-on-write is a memory-management technique that copies on write.
- C. Demand paging loads pages when they are needed.