🎓 BookMCQ
← Back to 16. Virtual Machines

📝 The virtual machine life cycle (10 MCQs)

Stages from Virtual Machine Creation to Removal

The virtual machine life cycle describes the stages through which a virtual machine passes during creation, configuration, operation, suspension, migration, restoration, and deletion. Management software and the hypervisor coordinate these transitions while maintaining virtual hardware definitions and resource assignments. Understanding the life cycle helps administrators control system availability, capacity, recovery, and security throughout a guest's use.

Why Controlled State Transitions Are Necessary

Virtual machines consume host CPU, memory, storage, and network resources even when they are not actively processing application work. Uncontrolled creation or termination can leave unused resources, inconsistent storage, or service interruption. Defined lifecycle operations allow administrators to start, stop, preserve, move, and remove guest environments safely.

Provisioning, Execution and State Management

Provisioning creates a virtual machine definition and assigns virtual hardware. The hypervisor powers it on and loads the guest operating system. During operation, management tools can monitor, pause, resume, snapshot, or migrate the VM. Shutdown releases active execution resources, while deletion removes its configuration and, when selected, associated virtual storage.

Example of a Test VM Lifecycle

An administrator creates a Linux test VM with two virtual CPUs and 4 GB of memory, installs required software, and captures a snapshot. The VM is used for testing, then shut down. Later, the administrator restores the snapshot to repeat tests from the saved state and eventually deletes the temporary environment.

Resource Management and State Consistency

Lifecycle management supports repeatable deployments, recovery, maintenance, and efficient use of host capacity. Snapshots can consume significant storage, and poorly planned shutdowns may interrupt applications or corrupt unsaved data. Administrators must distinguish guest shutdown from forced power-off and ensure that storage and network states remain consistent during migrations and recovery operations.

Misconceptions About Virtual Machine States

'Suspending a VM is identical to shutting it down' is false because suspension preserves execution state. 'Deleting a VM always deletes every virtual disk' depends on the management operation and storage policy. 'A snapshot is a complete backup by itself' ignores dependencies on base disks and storage infrastructure.

Exam Focus: Lifecycle States and Transitions

Sequence provisioning, power-on, execution, pause, resume, shutdown, migration, and deletion. Distinguish snapshots from backups and suspension from shutdown. Questions may ask which resources are held in each state or how administrators preserve guest consistency before a migration, restoration, or removal operation.

Key Terms of the VM Life Cycle

  • Provisioning - Creating and configuring a virtual machine.
  • Power-on - Starting guest execution.
  • Suspension - Pausing while preserving execution state.
  • Snapshot - Saved point-in-time virtual machine state.
  • Deprovisioning - Removing a virtual machine from service.
2
Easy
5
Medium
3
Hard

📝 All The virtual machine life cycle MCQs

Q1. What does the abbreviation VCPU stand for in virtualization?

A.Virtual Central Processing Unit
B.Virtual CPU ✅
C.Virtual Core Processing Unit
D.Virtualized Control Processing Unit
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The correct answer is B because VCPU is the common shorthand for \Virtual CPU

Q2. Why does a trap-and-emulate VMM need to run the guest kernel in physical user mode?

A.To prevent privileged instruction execution ✅
B.To improve performance
C.To allow direct hardware access
D.To simplify memory management
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Option A is correct because running the guest kernel in physical user mode forces any privileged instruction to trap, allowing the VMM to emulate it safely. Option B is incorrect; performance is actually reduced by the extra trapping. Option C would break isolation by granting hardware access, and Option D is unrelated to the core purpose of trap‑and‑emulate. This design keeps the host protected while the guest believes it has a kernel.

Q3. A guest operating system tries to execute a privileged instruction while running under a trap‑and‑emulate VMM. What should the VMM do?

A.Emulate the instruction and resume the guest ✅
B.Shut down the guest immediately
C.Ignore the instruction and let the CPU fault
D.Switch to hypervisor mode and reboot the host
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The VMM must emulate the privileged instruction (option A) so the guest can continue as if it succeeded. Shutting down the guest (option B) would be unnecessary and disruptive. Ignoring the instruction (option C) would cause a fault and crash the guest. Rebooting the host (option D) is far beyond the VMM’s responsibility. Emulation preserves isolation while providing the expected behavior.

Q4. Which CPU feature most directly enables hardware‑assisted virtualization?

A.Hardware virtualization extensions (e.g., VT‑x, AMD‑V) ✅
B.Larger on‑chip cache
C.Multiple cores
D.Higher clock speed
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Hardware virtualization extensions are designed to let the CPU distinguish between guest and host privileged operations, making virtualization feasible (option A). A larger cache (option B) may improve performance but does not affect virtualization capability. Multiple cores (option C) allow parallel execution but still require virtualization support. Higher clock speed (option D) speeds up computation but does not provide the necessary control mechanisms. Thus, extensions like VT‑x are the key enabler.

Q5. When comparing binary translation to trap‑and‑emulate, which statement is true regarding performance?

A.Binary translation can reduce overhead by converting privileged code to safe equivalents ✅
B.Trap‑and‑emulate is always faster because it uses fewer CPU cycles
C.Both techniques have identical performance characteristics
D.Binary translation works only on ARM processors
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Binary translation (option A) rewrites privileged instructions into user‑mode equivalents, which often lowers the number of traps and improves performance. Option B is false; trap‑and‑emulate incurs a trap for every privileged instruction, adding latency. Option C ignores the differing mechanisms that affect speed. Option D is incorrect because binary translation is a general technique, not limited to ARM. Therefore, binary translation generally offers a performance advantage.

Q6. How are virtual user mode and virtual kernel mode mapped on the physical machine in a trap‑and‑emulate system?

A.Virtual user maps to physical kernel mode
B.Virtual kernel maps to physical kernel mode
C.Virtual user maps to physical user mode
D.Both virtual user and virtual kernel modes map to physical user mode ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: In trap‑and‑emulate designs, both virtual user and virtual kernel modes execute in physical user mode, ensuring that any privileged instruction triggers a trap (option D). Mapping virtual user to physical kernel (option A) would violate isolation. Mapping virtual kernel to physical kernel (option B) would let privileged instructions run unchecked. Option C only maps one mode correctly. The dual‑user‑mode mapping is essential for safe emulation of kernel behavior.

Q7. A VMM must schedule three guests, each with its own VCPU state. Which action is required when switching from Guest A to Guest B?

A.Save only the program counter of Guest A
B.Save registers and memory state of Guest A ✅
C.No state saving is needed because the VMM handles it automatically
D.Save only the instruction pointer of Guest A
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When switching guests, the VMM must preserve the full execution context—including registers, flags, and memory mappings—so that Guest B can resume correctly; this is captured in option B. Saving only the program counter (option A) or instruction pointer (option D) would lose critical state, causing incorrect execution. Option C is false because the VMM cannot magically retain state without explicit saving. Comprehensive state saving ensures accurate virtual CPU restoration.

Q8. If a CPU lacks hardware virtualization extensions, which limitation(s) apply to a VMM?

A.Only one guest can run at a time
B.Privileged instructions cannot be trapped
C.The VMM must rely solely on binary translation
D.All of the above ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Without hardware support, a VMM faces several constraints: it can typically host only a single guest (option A), cannot directly trap privileged instructions (option B), and therefore must depend on binary translation to rewrite those instructions (option C). Since each of these issues arises, the correct answer is D, \All of the above.\ Recognizing these limits helps explain why modern CPUs include virtualization features to avoid such restrictions.

Q9. In a nested virtualization scenario where a guest runs its own hypervisor, what is required for correct operation?

A.The guest hypervisor can execute privileged instructions directly on the hardware
B.The outer VMM must double‑trap privileged instructions from the inner hypervisor ✅
C.Binary translation cannot be used in nested setups
D.Nested VMs require hardware support for virtualization extensions
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Nested virtualization demands that the outer VMM intercept privileged operations from the inner hypervisor, effectively double‑trapping (option B), but the most reliable solution is hardware support that allows multiple levels of virtualization (option D). Allowing the inner hypervisor to execute directly (option A) would break isolation, and binary translation alone (option C) struggles with multiple layers. Therefore, hardware extensions are essential for nested VMs.

Q10. When choosing between using a VCPU abstraction and giving a guest direct hardware access, which trade‑off is most accurate?

A.VCPU provides isolation but adds execution overhead ✅
B.VCPU eliminates all overhead compared to direct access
C.VCPU prevents any form of virtualization
D.VCPU works only on ARM architectures
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Using a VCPU (option A) isolates each guest’s state, protecting the host, but the additional context‑switching and emulation introduce overhead. Option B is false because the abstraction inherently adds some cost. Option C misstates the purpose; VCPU enables virtualization rather than preventing it. Option D incorrectly limits VCPU to a specific architecture. Understanding this trade‑off helps system designers balance security and performance when configuring virtual environments.

🔗 Related Topics (MCQs)