A Level · Topic 15.1
A-Level Computer Science 9618 / Topic 15 / A2

A computer made of software.

A virtual machine is software that behaves like a complete computer, so one physical machine can run several operating systems at once. This lesson explains the concept, gives examples of the roles virtual machines play, and weighs up their benefits and limitations.

The key idea

A virtual machine (VM) is an emulation of a computer system in software. The virtual machine software (a hypervisor) runs on the real hardware, usually on top of a host operating system, and presents emulated hardware to one or more guest operating systems, each of which behaves as if it had a whole computer to itself. Guest instructions are passed to, or translated for, the real hardware by the virtual machine software. VMs are used to run several operating systems on one computer, to run legacy software, to test software safely and to share servers between many customers. The main benefits are isolation (a crash or a virus in one guest does not affect the host or the others) and saving hardware; the main limitations are reduced performance and the need for a powerful host with plenty of memory.

two guest operating systems running on one physical computer guest applicationslegacy application guest OS 1 (e.g. Linux)guest OS 2 (older OS) virtual machine software (hypervisor) host operating system physical hardware: CPU, RAM, disk, network each dashedbox is onevirtualmachine emulates thehardware foreach guest each guest OS behaves as if it had a whole computer to itself
Fig. 1: the virtual machine software sits between the guests and the host, giving each guest operating system its own emulated hardware
Section 01

The concept of a virtual machine.

A guest operating system cannot tell the difference between real hardware and the emulated hardware that the virtual machine software gives it. That is the whole idea.

Examiner trap

A virtual machine is not extra hardware and it is not the same as virtual memory. It is software that emulates a whole computer.

Section 02

The roles of virtual machines.

Questions often ask you to give examples of what virtual machines are used for. Each one below comes with the reason a VM helps.

RoleWhy a virtual machine helps
Running more than one operating system on one computerA user can run, for example, Linux as a guest on a Windows host, without a second computer or restarting.
Running legacy softwareAn old program that only runs on an out-of-date operating system can still be used in a guest running that OS.
Testing new softwareDevelopers can test a program on many operating systems, or test an update, without risking the host; a snapshot lets the VM be reset after each test.
Studying malware safelyA suspected virus can be run in an isolated guest so it cannot damage the host or the network.
Server consolidation and cloud computingOne powerful physical server runs many virtual servers, each rented to a different customer or used for a different service.
Portable programsA process virtual machine such as the JVM lets the same bytecode run on any platform.
Worked example Explaining a role in context
A company's payroll program only runs on an operating system that is no longer supported, and the old computer is failing. Explain how a virtual machine could help.
  1. Virtual machine software is installed on a new computer with a modern host operating system.
  2. A virtual machine is created and the old operating system is installed as a guest.
  3. The payroll program is installed and run in the guest, which behaves like the old computer.
  4. The company can keep using the program while the old hardware is retired.
Answer: Run the old OS as a guest on new hardware, and run the legacy program inside it
Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

What is a virtual machine?

Quick check+10 XP

In a virtual machine setup, what is the guest operating system?

Quick check+10 XP

Why is a virtual machine a safe place to run a suspected virus?

Quick check+10 XP

Which is a limitation of virtual machines?

Section 03

Benefits and limitations.

For a full answer, give a benefit or limitation and then explain it: what it means for the user or the organisation.

BenefitsLimitations
Isolation: a crash, a faulty program or a virus in one guest does not affect the host or the other guests.Reduced performance: instructions pass through the virtual machine software, so the guest runs more slowly than it would on real hardware.
Less hardware: several systems run on one physical computer, saving money, space and energy.A powerful host is needed: each guest needs its own share of memory, storage and processor time.
Several operating systems can be used on one computer at the same time.Some hardware cannot be emulated well, so certain devices or software (for example some games or specialist drivers) may not work in a guest.
Easy backup and recovery: a whole VM is a file that can be copied, moved to another server or rolled back to a snapshot.Complexity: virtual machine software must be set up and managed, and a failure of the physical host stops every guest on it.
Your turn
A software developer tests every new version of her app in a virtual machine. Give one benefit and one limitation of doing this.
Examiner trap

"It is slower" earns little on its own. Say why: the virtual machine software has to intercept and translate the guest's instructions, which adds an overhead.

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to A Level Paper 3 and Paper 4 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

Which is an example of the role of a virtual machine?

Exam style+20 XP

Why does a computer that hosts several virtual machines need a large amount of RAM?

Exam style+20 XP

What does the Java Virtual Machine allow?

Exam style+20 XP

A web hosting company runs 40 virtual servers on 4 physical servers. Which is a benefit for the company?

Skill unlocked

Virtual machines, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
The concept of a virtual machine, its roles, benefits and limitations.