Show understanding of the concept of a virtual machine

15.1 Processors, Parallel Processing and Virtual Machines

Learning Objective

Show understanding of the concept of a virtual machine (VM) and its role in modern computing, including its types, architecture, benefits, limitations, security issues and relevance to parallel processing and cloud‑computing.

What is a Virtual Machine?

A virtual machine (VM) is a software abstraction that emulates a complete physical computer system. It provides an isolated execution environment that behaves like a real processor, memory, storage and I/O devices, allowing programmes to run as if they were on dedicated hardware.

Key Characteristics of a VM

  • Isolation: each VM runs independently of other VMs on the same host.
  • Portability: a VM image can be moved between different physical machines without modification.
  • Resource sharing: multiple VMs share the underlying CPU, RAM, disk and network resources.
  • Encapsulation: the complete state of a VM (CPU registers, memory, storage, etc.) can be saved, copied or restored.

Types of Virtual Machines

  1. System Virtual Machines – emulate an entire operating system. Examples: VMware Workstation, Oracle VirtualBox, Microsoft Hyper‑V.
  2. Process (or Language) Virtual Machines – provide a runtime environment for a single programme or language. Examples: Java Virtual Machine (JVM), .NET Common Language Runtime (CLR).

Processor Fundamentals (Syllabus Requirement)

RISC vs. CISC and Pipelining

RISC (Reduced Instruction Set Computing) processors use a small, highly optimised set of instructions that can execute in a single clock cycle. CISC (Complex Instruction Set Computing) processors provide many more instructions, some of which perform complex operations in a single instruction.

Both families employ pipelining – the technique of overlapping the fetch, decode, execute and write‑back stages of several instructions so that multiple instructions are in different stages of execution at the same time. Pipelining increases instruction throughput but introduces hazards that the hardware must resolve.

Because a VM abstracts the underlying ISA, the same guest OS or process VM can run on a RISC‑based host (e.g., ARM) or a CISC‑based host (e.g., x86) without modification. The hypervisor translates privileged VM instructions into the appropriate native ISA, shielding the guest from hardware differences.

Four Basic Computer Architectures

ArchitectureDefinitionTypical UseVM Relevance
SISDSingle Instruction, Single Data stream – a single processor executes one instruction on one datum at a time.Traditional desktop CPUs.A single‑CPU VM maps one vCPU to the physical core; no inherent parallelism.
SIMDSingle Instruction, Multiple Data – one instruction operates on many data elements simultaneously.Vector processors, GPU shaders.A VM can expose SIMD extensions (e.g., AVX) to guests, allowing parallel data processing inside the VM.
MISDMultiple Instruction, Single Data – rare in practice; multiple processors work on the same datum.Specialised fault‑tolerant systems.Not commonly virtualised; would require coordinated scheduling of several vCPUs on the same data stream.
MIMDMultiple Instruction, Multiple Data – independent processors execute different instructions on different data.Multi‑core and distributed systems.System VMs on a MIMD host allocate separate vCPUs to each guest, enabling true parallel execution of several OSes or applications.

Massively‑Parallel Computers

Massively‑parallel systems contain dozens, hundreds or thousands of processing elements (cores, GPU streaming processors, or specialised accelerator tiles) that work concurrently on large data sets. Examples include modern GPU arrays, many‑core CPUs (e.g., Intel Xeon Phi) and dedicated super‑computers.

When a host is massively parallel, the hypervisor can provision a VM with many vCPUs, allowing the guest to exploit the underlying parallel hardware. In practice, the guest OS schedules its own threads across the allocated vCPUs, which the hypervisor maps onto the physical cores.

Virtualisation Architecture

The host computer runs a hypervisor (also called a virtual‑machine monitor). The hypervisor sits between the physical hardware and the VMs and performs two essential tasks:

  • Translating privileged VM instructions into safe operations on the physical CPU.
  • Managing allocation of memory, storage, network and CPU time to each VM.

Hypervisor Types (Cambridge Syllabus Requirement)

  • Type‑1 (bare‑metal) hypervisor: runs directly on the hardware without a host OS (e.g., VMware ESXi, Microsoft Hyper‑V Server).
  • Type‑2 (hosted) hypervisor: runs as an application on top of a host operating system (e.g., VirtualBox, VMware Workstation).

Key Terminology

  • Host: the physical machine that provides the hardware resources.
  • Guest: the operating system or application that runs inside a VM.
  • vCPU: a virtual CPU allocated to a VM; the hypervisor maps one or more vCPUs onto physical cores.
  • Snapshot: a saved state of a VM that can be restored later.

Benefits of Using Virtual Machines

BenefitExplanation
ConsolidationMany VMs replace multiple physical servers, reducing hardware purchase and energy costs.
Testing & DevelopmentDevelopers can create disposable environments, test software on different OSes, and revert to a clean snapshot instantly.
Security IsolationA compromised VM can be shut down or deleted without affecting the host or other VMs.
Scalability & FlexibilityResources (CPU, RAM, storage) can be re‑allocated to VMs on demand, supporting dynamic workloads.

Limitations & Overheads of Virtualisation

  • Performance overhead: translating instructions and managing resources adds latency; CPU‑intensive workloads may run 5‑15 % slower than on bare metal.
  • Resource contention: if too many VMs compete for the same physical resources, performance degrades.
  • Management complexity: configuring, updating and securing multiple VMs and the hypervisor requires skilled administration.

Security Considerations

  • Although VMs provide isolation, vulnerabilities such as hypervisor attacks or VM escape can allow a malicious guest to affect the host.
  • Mitigation: regular patching of the hypervisor, using trusted VM images, limiting privileged operations, and applying the Cambridge security policies (Section 17) to both host and guest.

Virtualisation in Cloud Computing (Cross‑Reference)

Modern cloud services (IaaS – Infrastructure as a Service) rely heavily on VMs. Providers such as Amazon EC2, Microsoft Azure and Google Compute Engine offer virtual machines that can be created, resized and destroyed on demand, illustrating the concepts of portability, scalability and consolidation covered in this unit.

Virtual Machines and Parallel Processing

On a multi‑core or massively‑parallel host, the hypervisor can schedule different VMs on different physical cores, achieving true parallel execution. A single VM may also be configured with multiple vCPUs, which the hypervisor maps onto available cores.

Amdahl’s Law – estimating speed‑up

The theoretical speed‑up when a portion of a programme is parallelised is given by:

\$S = \frac{1}{(1 - P) + \frac{P}{N}}\$

where:

  • S – overall speed‑up
  • P – fraction of the programme that can be parallelised
  • N – number of parallel units (e.g., vCPUs)

Example: If 80 % of a workload can be parallelised (P = 0.8) and the VM is given 4 vCPUs (N = 4), the expected speed‑up is:

\$S = \frac{1}{(1-0.8) + \frac{0.8}{4}} = \frac{1}{0.2 + 0.2} = 2.5\$

This demonstrates diminishing returns as the non‑parallel portion dominates, a point that is examined in the AO2 parallel‑processing criteria.

Example: Java Virtual Machine (JVM)

The JVM is a process virtual machine that executes Java bytecode. Key features include:

  • Automatic memory management (garbage collection).
  • Just‑In‑Time (JIT) compilation – converting bytecode to native machine code at runtime for improved performance.
  • Platform independence – the same .class files run on any device with a compatible JVM.

Glossary of Key Terms

  • Hypervisor: software layer that creates and manages VMs.
  • Host: the physical computer on which VMs run.
  • Guest: the OS or application inside a VM.
  • vCPU: a virtual CPU allocated to a VM.
  • Snapshot: a saved state of a VM that can be restored later.
  • Type‑1 / Type‑2 hypervisor: classification based on whether the hypervisor runs directly on hardware or on a host OS.
  • VM escape: a security breach where code inside a VM gains access to the host.
  • RISC / CISC: two major instruction‑set philosophies; RISC uses a small, fast set of instructions, CISC a larger, more complex set.
  • Pipelining: overlapping the stages of instruction execution to increase throughput.
  • SISD, SIMD, MISD, MIMD: the four basic computer architectures defined by Flynn.

Suggested Diagram

Layered view (bottom → top): Physical hardware → Type‑1 or Type‑2 hypervisor → Multiple system VMs (each with its own guest OS) → Process VMs (e.g., JVM) running applications.

Summary Checklist (Exam‑style)

  1. Define a virtual machine and differentiate between system and process VMs.
  2. Explain the role of the hypervisor and distinguish Type‑1 from Type‑2.
  3. State the differences between RISC and CISC processors and describe how pipelining improves performance.
  4. List the four basic computer architectures (SISD, SIMD, MISD, MIMD) and give one example of how a VM can be used on each.
  5. Identify three benefits of using VMs and two limitations/overheads.
  6. Identify security risks associated with virtualisation and suggest mitigation measures.
  7. Describe how VMs enable parallel processing on multi‑core and massively‑parallel hosts.
  8. Apply Amdahl’s Law to calculate an estimated speed‑up when adding vCPUs.
  9. Relate virtualisation to cloud‑computing concepts such as IaaS.