OS - Virtualization

Updated: 2018-12-09

VM

VMM(Virtual Machine Manager) = Hypervisor

QEMU is the default VMM of KVM, but can be replaced.

2 Types:

  • Type-1: bare metal hypervisor

    • hypervisor runs directly on the host's hardware.
    • e.g. XEN, Hyper-V(used in Windows 10), VMware ESX/ESXi
  • Type-2: hosted hypervisor

    • hypervisor runs on a conventional operating system, a guest operating system runs as a process on the host.
    • e.g. VMware Workstation, VirtualBox, QEMU

KVM, as name suggests, is kernel-based, so can be considered as both Type-1 and Type-2.

Container

OCI, Open Container Initiative, defined 2 specs, so different tools can be used to pack/unpack and run by different runtimes:

Container vs VM

Container = Operating system level virtualization

Docker vs LXC vs LXD vs cgroups

  • Docker initially used liblxc but later changed libcontainer
  • Linux Containers (LXC): on top of cgroups. operating system–level virtualization technology for running multiple isolated Linux systems (containers) on a single control host (CoreOS instance).
  • cgroups: provides namespace isolation and abilities to limit, account and isolate resource usage (CPU, memory, disk I/O, etc.) of process groups
  • LXD is built on top of LXC, using liblxc

Paravirtualization(PV) vs Hardware Virtual Machine (HVM)

  • Paravirtualization: guest OS knows that it is running on a hypervisor instead of base hardware,recognizes that other virtual machines are running on the same machine
  • Hardware Virtual Machine (HVM): guest OS thinks that it is running directly on the hardware

Xen supports 2 virtualization types, ( Meaning Amazon supports 2 types as it runs on Xen )

  • Xen Para-virtulaization ( PV )
  • Xen Full virtualization ( HVM )

HVM stands for Hardware-assited Virtual Machine.

Para-virtulaization ( PV )

  • An OS or Kernel called Hypervisor is installed on the hardware.
  • Dom0 is called the “privilged domain” which can issue commands to the hypervisor.

PRO

  • Stability/Performance is close to the real servers and hardware virtualization.
  • Overhead is very low

CONS

  • Implementation is tough.
  • Both the host & guest kernels has to be patched.
  • Supports Linux only
  • can’t change the OS options during install.
  • Can’t compile and install a custom kernel

HVM

Stands for Hardware-assisted virtual machine. It provides complete hardware isolation. The hardware provides support to run independently for each OS

PROS

  • Can run Linux and Windows
  • Complete secure hardware isolation
  • Resembles close to a physical server.
  • Greater stability

CONS

  • Low performance, because of the overheads at the hardware level