Virtual Machines (OCR A Level Computer Science): Revision Note
Exam code: H446
Virtual Machines
What are virtual machines?
A virtual machine (VM) is a software-driven computer that runs within a physical machine
It mimics a complete computer system, including virtual CPU, memory, storage, and network interface
A physical machine can run multiple VMs using hypervisor software
Each VM behaves as a separate system with its own operating system and applications, independent of the host OS
Executing intermediate code
Some languages (e.g. Java) compile to intermediate code (bytecode) instead of machine code
This bytecode can be executed by a virtual machine (like the Java Virtual Machine), allowing the same program to run on multiple platforms
Structure of several virtual machines running on a single piece of hardware

Uses of virtual machines
Cross-platform compatibility: Run MacOS apps on Windows or vice versa
Software testing: Safe, isolated environments for testing across multiple OS versions
Legacy support: Run older versions of Windows for outdated apps
Cross-platform and forwards compatibility
Not all software is designed to run on all operating systems
Apple commonly makes software that only runs on MacOS for performance reasons
A Windows user could run a virtual machine of MacOS and install the software they need
Most software needs to be updated to work on the latest versions of operating systems
A user running the latest release of Windows may need to run a virtual machine of a previous release of Windows to use an application that hasn't received a forwards-compatibility update
In software testing
VMs are a way to create isolated test environments, that leave the host operating system unaffected
Isolated environments allow a developer to:
Monitor the way their software affects system performance
Test on a clean-slate system, while no other applications are running
VM management software can create virtual machines that act like they have older hardware
This allows developers to build software that can be run on older hardware so that more users can use the software
A developer can test against various operating systems, such as MacOS, Linux and Windows, for greater compatibility
In A Level Computer Science, intermediate code is generated through compilation and allows programs to run across different operating systems
Consequences
VMs share the same system hardware as the host OS
Over-use of VMs can exhaust the host OS of the system of CPU, hard disk and memory
VM software such as VirtualBox can set maximum limits on system resources
A low-specification machine could be configured to allocate only 1GB of memory and 20% of CPU
A high-specification machine could afford up to 8GB of memory and 50% of the CPU
Operating systems are commonly free to download, but require an activation payment to access all features
Benefits | Drawbacks |
---|---|
Allows software to run on different operating systems (cross-platform) | Uses system resources such as CPU, RAM, and storage from the host machine |
Supports running legacy applications on older operating systems | Performance is usually slower than running software directly on physical hardware |
Provides isolated test environments for safe software testing | Can be complex to set up and manage |
Enables execution of intermediate code (e.g. Java bytecode via JVM) | May require additional licences or activation for virtualised OSs |
Multiple VMs can run on a single physical machine, improving hardware usage | Resource limits can cause crashes or lag if poorly configured |
Easy to reset or rollback using snapshots | Not all hardware features can be virtualised accurately |
Worked Example
Explain why the programmers of anti-virus software may make use of virtual machines when developing the updates.
[3]
How to answer this question:
Recall two benefits of using virtual machines in developing software
Link these benefits to some considerations needed when developing anti-virus software
Answer:
Example answer that gets full marks:
Virtual machines (VMs) are essential in developing anti-virus software updates for several reasons. VMs create an isolated environment that is separate from the host operating system. This enables developers to safely work with virus test code that could risk the integrity of their own operating system. VMs can also be configured to emulate various types of hardware. This allows developers to understand how their anti-virus software will perform on different devices and under different conditions, ensuring a wider range of compatibility.
Acceptable answers you could have given instead:
Virtual machines create an isolated test environment from the host operating system. This means working with harmful test code carries less risk. Virtual machine management software can monitor the VM through the Hypervisor. This will show how the software affects VM system performance, allowing the programmer to make changes where needed.
You've read 0 of your 5 free revision notes this week
Unlock more, it's free!
Did this page help you?