Show understanding of the concept of a virtual machine

15.1 Processors, Parallel Processing and Virtual Machines

Processors & Parallel Processing (Quick Overview)

Processors (CPUs) are like the brains of a computer. They perform calculations and run instructions. Modern CPUs have multiple cores, so they can do many tasks at once – this is parallel processing 🧠. Think of it as a team of workers in a factory, each handling a part of the job simultaneously, speeding up the whole process 🚀.

Virtual Machines – The Core Idea

A Virtual Machine (VM) is a software‑defined computer that runs on top of real hardware. It pretends to be a full computer, with its own operating system and applications, but it is actually just a set of instructions that the host machine follows. Imagine a play‑by‑play simulation of a car inside a sandbox 🏗️ – the sandbox is the real hardware, and the car is the VM.

Mathematically, a VM can be represented as: $$ VM = \{ \text{Guest OS}, \text{Virtual CPU}, \text{Virtual Memory}, \text{Virtual I/O} \} $$

How a VM Works – Inside the Box

  • 1️⃣ Hypervisor – The software layer that sits between the physical hardware and the VM. It allocates CPU cycles, memory, and I/O to each VM.
  • 2️⃣ Virtual Hardware – The hypervisor presents a set of virtual devices (CPU, RAM, disk) to the guest OS.
  • 3️⃣ Guest OS – The operating system that runs inside the VM, unaware that it is virtualised.
  • 4️⃣ Isolation – Each VM is sandboxed; one VM’s crash or malware cannot directly affect another.
  • 5️⃣ Performance Overhead – Because the hypervisor translates virtual calls to real hardware, there is a small performance cost.

Common Types of Virtual Machines

  1. 🖥️ Full Virtualisation – e.g., VirtualBox, VMware Workstation. The VM runs a complete OS.
  2. 🐳 Container Virtualisation – e.g., Docker. Shares the host OS kernel but isolates user space.
  3. 📱 Emulators – e.g., Android Emulator, which mimics a different hardware architecture.
  4. Java Virtual Machine (JVM) – Executes Java bytecode on any platform.

Benefits & Drawbacks

  • ?? Portability – Same VM image runs on any host.
  • ?? Isolation – Secure separation of applications.
  • ?? Resource Efficiency – Multiple VMs share the same physical hardware.
  • Overhead – Slight performance hit compared to native execution.
  • Complexity – Requires management of hypervisors and VM images.

Real‑World Examples

  • 🛠️ VirtualBox – Free desktop hypervisor for running multiple OSes.
  • ☁️ Amazon EC2 – Cloud VMs that scale on demand.
  • 🧪 JVM – Allows Java programs to run on Windows, macOS, Linux, and more.
  • 📦 Docker – Lightweight containers for deploying microservices.

Summary Table

VM Type Typical Use Key Feature
Full Virtualisation (VirtualBox, VMware) Running full OSes on a host machine Complete isolation, hardware emulation
Container Virtualisation (Docker) Deploying microservices Shared kernel, lightweight isolation
JVM (Java Virtual Machine) Running Java applications anywhere Bytecode interpretation, platform independence

Revision

Log in to practice.

2 views 0 suggestions