Virtualization Basics

shashank Jain
3 min readMay 9, 2018

In this series we look at the various aspects of Virtualization and in particular the OS virtualization. We start with a high level introduction to virtualization and then deep dive in further series. The intent here is to understand what a virtual machine means and what is happening under the hoods.

With virtual machines, multiple OSes will share the same hardware resources with virtualized representation of each of the resource available to the VM. So a VM can continue to do block operations on a disk (in this case it’s a virtual disk), thinking that it’s the only OS running on the hardware.

To virtualize the OS a special piece of software is used. This is termed as the hypervisor. The hypervisor itself has 2 parts

1. VMM — used for trap and emulate the privileged instruction set
2. Device Model — for virtualizing the i/o

VMs are pretty similar to OS process .VMs execute in a hardware isolated virtual address space and at a lower privilege level then the Host OS. The primary difference between a process and a VM is the ABI exposed by the host to the VM. In case of process the ABI has things like network sockets, FD etc while in case of a full fledged OS virtualization the ABI will be virtual disk, network cards etc. Since the hardware is not available directly (though in some cases it can be) to the VM the role of VMM is to trap privileged instructions on CPU as well as access to the hardware like disk/network card.

--

--