Skip to content

Containers VMs Hypervisor

Pasted image 20260819214015.png

Hardware: actual CPU, memory, disk, network.
Hypervisor: carves hardware into isolated VMs. (creates/manages VMs) VM: runs a full OS on virtual hardware (that hypervisor manages).
Guest OS: the OS inside a VM. (each one has its own kernel) Host OS: your Mac’s OS
Container: isolated process using the host/VM kernel running on daemon.

2 types of hypervisors

  • type 1 baremetal - installed directly on physical hardware
  • type 2 hosted - installed on host OS Pasted image 20260507211246.png

2 types of VMs

  • Process VM
    • ex: JVM, cpython
    • virtualizes runtime, not hardware
    • userspace
  • Hypervisor VM
    • ex: baremetal VM or hosted VM
    • virtualizes hardware
    • kernel

Kernel

  • core component of OS
  • manages hardware
  • used by hosted VM hypervisor

Pasted image 20260819214015.png

Hypervisor details

Type 1 β€” Bare Metal (e.g., VMware ESXi) Hypervisor runs directly on hardware, without a general-purpose host OS underneath it.

  1. Hypervisor boots directly on physical hardware.
  2. Hypervisor creates a VM and allocates physical RAM/CPU resources.
  3. (shared steps)

Type 2 β€” Hosted (e.g., VirtualBox, VMware Workstation) Hypervisor runs on top of a regular host OS.

  1. Host OS boots and manages physical hardware.
  2. Hypervisor software runs using host OS services.
  3. Hypervisor creates a VM; host OS helps allocate memory and manage device I/O.
  4. (shared steps)

shared steps

  1. Guest OS boots inside the VM.
  2. Guest OS maintains page tables: Guest Virtual β†’ Guest Physical.
  3. Hypervisor configures second-stage page tables: Guest Physical β†’ Machine Physical.
    1. stores in memory, gives register to CPU so CPU can enforce
  4. CPU uses both mappings to access physical memory, enforcing isolation in hardware.
  • Guest OS processes have their own virtual address space
  • Guest OS page tables map guest virtual β†’ guest physical
    • Guest OS maintains a page table
    • Guest OS maps process virtual address address to Guest physical address (still virtual but emulates RAM)
  • Hypervisor will map guest physical -> machine physical
    • maps the VM guest OS physical address -> machine physical address space
    • stores that configuration in memory
    • gives a special CPU register pointer to that memory
  • when CPU runs instruction from a VM process, it walks through that special register and VM to address space memory -> enforces at the hardware level that VM can only access it's own memory space and not any others