🎓 BookMCQ
← Back to 16. Virtual Machines

📝 Hardware assisted virtualization (14 MCQs)

Processor Extensions for Efficient Virtual Machine Execution

Hardware-assisted virtualisation uses processor features designed to support hypervisors and guest operating systems directly. Technologies such as Intel VT-x and AMD-V introduce execution modes and control structures that help separate guest operation from hypervisor control. These features allow sensitive guest operations to trigger controlled transitions, reducing reliance on complex software techniques for virtualising processor behaviour.

Why Software Only Virtualisation Had Limitations

Older processors did not always trap every sensitive instruction when guests ran at reduced privilege. Hypervisors therefore needed binary translation or other workarounds to preserve isolation. Processor extensions address this problem by providing explicit virtualisation support, while also introducing additional state that must be managed during guest transitions.

Guest Mode, Root Mode and Virtual State

The hypervisor configures processor control structures and launches a guest in a designated virtualised execution mode. When a configured event or sensitive operation occurs, the processor transfers control to the hypervisor. The hypervisor examines the exit information, handles the event, updates guest state, and resumes execution when safe.

Example of a Guest Access to Control State

A guest operating system attempts to execute a protected control-register operation. Processor virtualisation support causes a virtual machine exit according to the configured controls. The hypervisor updates or validates the guest's virtual register state and performs any required host-side action before allowing the guest to continue.

Reduced Translation Overhead and Remaining Costs

Hardware assistance improves compatibility and often reduces software translation overhead. It does not eliminate all virtualisation costs: guest exits, memory address translation, device emulation, and resource contention still affect performance. Efficient operation depends on appropriate processor features, hypervisor configuration, memory management, and device support.

Misconceptions About Hardware Virtualisation

'VT-x or AMD-V automatically installs a hypervisor' is false because software must configure and use the features. 'Every guest instruction causes a virtual machine exit' ignores direct execution. 'Hardware assistance removes all performance overhead' overlooks memory translation, I/O handling, and scheduling costs.

Exam Focus: Hardware Modes and VM Exits

Explain how processor virtualisation extensions separate guest execution from hypervisor control. Identify the roles of guest state, control structures, and virtual machine exits. Questions may compare hardware assistance with binary translation or ask why a privileged guest operation causes a controlled transfer to the hypervisor.

Key Terms of Hardware Assisted Virtualisation

  • VT-x - Intel processor virtualisation extension.
  • AMD-V - AMD hardware virtualisation technology.
  • VM exit - Transfer from guest to hypervisor.
  • Guest state - Processor state maintained for a VM.
  • Hypervisor - Controls virtual machine execution.
3
Easy
7
Medium
4
Hard

📝 All Hardware assisted virtualization MCQs

Q1. What is the primary purpose of hardware assistance in virtualization?

A.To increase CPU clock speed
B.To reduce memory usage
C.To enable efficient trapping of privileged instructions ✅
D.To improve network latency
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Hardware assistance is designed to make privileged operations fast by allowing the CPU to handle them directly, rather than trapping to software. Option C describes this function, while the other options talk about unrelated improvements such as clock speed, memory usage, or network latency, which are not the main goal of hardware virtualization support. Understanding this purpose helps students see why modern CPUs include virtualization extensions that speed up VM execution.

Q2. Which hypervisor type does not require the building blocks discussed for efficient virtualization?

A.Type 0 ✅
B.Type 1
C.Type 2
D.Type 3
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Type 0 hypervisors run directly on the hardware and do not need the extra building blocks that type 1 or type 2 hypervisors rely on. Therefore option A is correct. Options B, C, and D refer to other hypervisor classifications that still require mechanisms like a virtual CPU scheduler or memory translation, making them incorrect. Recognizing the distinction clarifies why type 0 hypervisors are the simplest form of virtualization.

Q3. Why are dual-mode systems a challenge for virtual machine implementation?

A.Because they lack user mode
B.Because privileged instructions must be intercepted ✅
C.Because they have too many registers
D.Because they use non-volatile memory
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Dual‑mode CPUs have only user and kernel modes, so any privileged instruction executed by a guest must be intercepted and emulated by the hypervisor. This interception is the core difficulty, which is captured by option B. Options A, C, and D describe issues that are not specific to dual‑mode systems, so they are wrong. Knowing this challenge explains why hardware extensions that add a root mode are valuable.

Q4. How does hardware-assisted virtualization improve performance compared to pure software trapping?

A.It eliminates the need for page tables
B.It allows direct execution of privileged instructions in guest mode
C.It reduces the number of VM exits ✅
D.It increases cache size
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Hardware‑assisted virtualization reduces the number of VM exits because the CPU can execute many privileged instructions without trapping. Option C states this benefit, while option A incorrectly claims page tables are eliminated, option B suggests full direct execution (which still requires some trapping), and option D mentions cache size, which is unrelated. The explanation connects the reduced exit count to higher overall performance in real workloads.

Q5. A hypervisor on a CPU without hardware assistance experiences 1500 VM exits per second, each costing 2 μs2\,\mu s. If hardware assistance reduces exits by 80% and each remaining exit costs the same, what is the new total overhead time per second?

A.1.2 ms
B.0.6 ms ✅
C.3 ms
D.6 ms
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The original overhead is 1500 exits × 2 µs = 3000 µs (3 ms). Reducing exits by 80 % leaves 20 % × 1500 = 300 exits, giving 300 × 2 µs = 600 µs (0.6 ms). Option B presents this value, while the other options either double or omit the reduction. This calculation shows how hardware assistance can dramatically cut the time spent handling VM exits in a practical system.

Q6. A type 1 hypervisor uses hardware virtualization extensions that provide a new privilege level called root. Which of the following statements is true about code running in root mode?

A.It can directly access physical memory without translation
B.It runs with the same restrictions as guest kernel mode
C.It can execute privileged instructions without causing VM exits ✅
D.It must always trap to the hypervisor
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When a CPU provides a root privilege level, code running there can execute privileged instructions without causing a VM exit, because the hardware treats those instructions as safe for the hypervisor. Option C captures this behavior; option A incorrectly claims direct physical memory access without translation, option B suggests the same restrictions as guest kernel mode, and option D states every instruction must trap, which contradicts the purpose of root mode.

Q7. Explain why building blocks such as a virtual CPU (vCPU) scheduler are unnecessary for type 0 hypervisors.

A.Because type 0 hypervisors run on bare metal and manage resources directly ✅
B.Because type 0 hypervisors rely on the host OS scheduler
C.Because type 0 hypervisors do not support multiple VMs
D.Because type 0 hypervisors use only user-mode processes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Type 0 hypervisors sit directly on the hardware, so they manage resources like CPU and memory without an intermediate layer. Consequently, they do not need extra components such as a vCPU scheduler, which is required when multiple VMs share a host. Option A reflects this reality; options B, C, and D describe mechanisms that type 0 hypervisors either do not use or that are irrelevant to their operation.

Q8. A system supports nested virtualization where a guest hypervisor runs inside a VM. If the outer hypervisor provides hardware assistance that reduces the cost of a nested VM exit from 5 μs5\,\mu s to 1 μs1\,\mu s, and a workload triggers 2000 nested exits, what is the total time saved per second?

A.10 ms
B.2 ms
C.5 ms
D.8 ms ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Initially the workload costs 2000 exits × 5 µs = 10 ms. After hardware assistance each exit costs 1 µs, so the new cost is 2000 × 1 µs = 2 ms. The saved time is 10 ms − 2 ms = 8 ms, which appears in option D. The other options either miss the subtraction or use the wrong values, illustrating the performance gain achieved with nested‑virtualization support.

Q9. Consider a dual-mode CPU where every privileged instruction causes a trap. A developer designs a virtualization layer that batches 10 successive privileged instructions before trapping. If each trap incurs a fixed overhead of 0.5 μs0.5\,\mu s plus 0.1 μs0.1\,\mu s per instruction, what is the overhead per batch?

A.2.0 µs
B.1.0 µs
C.0.5 µs
D.1.5 µs ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The batch overhead consists of a fixed 0.5 µs plus 0.1 µs for each of the ten instructions: 0.5 + 10 × 0.1 = 1.5 µs. Option D lists this result. Options A, B, and C either omit the fixed cost or mis‑calculate the per‑instruction component, showing why careful accounting of both parts is essential for accurate performance modeling.

Q10. What role does the 'virtual machine monitor' (VMM) play in handling privileged instructions on systems without hardware assistance?

A.It directly executes them in user mode
B.It translates them to equivalent user-mode calls
C.It intercepts and emulates them in software ✅
D.It ignores them
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: On systems lacking hardware assistance, the VMM must catch privileged instructions and emulate their effect in software, which is described by option C. Options A and B suggest the VMM runs them directly or translates them to user calls, which is not possible without hardware support, and option D incorrectly says the VMM ignores them. This explanation clarifies the VMM’s role in providing a safe execution environment.

Q11. A cloud provider wants to run 100 VMs on a server with hardware virtualization support that can handle up to 250 VM exits per millisecond without degrading performance. If each VM generates on average 2 exits per millisecond, is the server within safe limits?

A.Yes, because total exits are 200 per ms
B.No, because total exits exceed 250 per ms ✅
C.Yes, because each VM stays under 250 exits
D.No, because hardware assistance requires fewer than 100 exits
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Each VM generates 2 exits per millisecond, so 100 × 2 = 200 exits per millisecond. This is below the hardware limit of 250 exits per millisecond, meaning the server can handle the load safely. Option B states this condition; the other options either claim the limit is exceeded or misinterpret the per‑VM versus total‑exit comparison, highlighting how to evaluate capacity with virtualization metrics.

Q12. Why does virtualization become more feasible as hardware support improves, even though the underlying machine still only has two modes?

A.Hardware adds a third privilege mode that isolates guests
B.Hardware reduces the need for software traps by allowing direct execution of privileged instructions ✅
C.Hardware eliminates the need for memory management
D.Hardware increases the clock speed
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Hardware extensions add new mechanisms that let the CPU execute privileged instructions directly in guest mode, dramatically lowering the need for software traps. Option B correctly describes this effect, while option A incorrectly claims a third privilege mode, option C suggests memory management is removed, and option D focuses on clock speed, none of which directly address the virtualization challenge.

Q13. A VM requires 500 I/O operations per second. Without hardware assistance each operation incurs 4 µs overhead; with assistance overhead is reduced to 1 µs. What is the total time saved per second?

A.2 ms
B.1.5 ms ✅
C.0.5 ms
D.1 ms
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Without assistance, the I/O overhead is 500 × 4 µs = 2000 µs (2 ms). With assistance the overhead becomes 500 × 1 µs = 500 µs (0.5 ms). The time saved is 2 ms − 0.5 ms = 1.5 ms, which matches option B. The other choices either omit the reduction or use the wrong values, demonstrating how hardware‑assisted I/O can improve VM performance.

Q14. A system uses extended page tables (EPT) that translate guest‑physical to host‑physical addresses. If a guest page walk requires 4 memory accesses and each access takes 0.2 μs0.2\,\mu s, what is the latency of a single guest memory translation? Additionally, if hardware assistance reduces each access to 0.05 μs0.05\,\mu s, what is the new latency?

A.0.2 µs and 0.8 µs
B.0.8 µs and 0.2 µs ✅
C.0.4 µs and 0.2 µs
D.0.8 µs and 0.5 µs
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A guest page walk needs four memory accesses. Without assistance each access takes 0.2 µs, giving 4 × 0.2 = 0.8 µs. With hardware assistance each access drops to 0.05 µs, so the latency becomes 4 × 0.05 = 0.2 µs. Option B lists both numbers correctly; the remaining options mix up the values, illustrating the latency advantage of extended page tables.

🔗 Related Topics (MCQs)