Friday, February 17, 2017

What is Virtualization?

An overview

In computing, virtualization is a broad term that refers to the abstraction of computer resources. The common theme of all virtualization technologies is the hiding of technical detail, through encapsulation. Examples- JVM, RAID, DFS, Virtual Memory, VMs, VHDs, etc.

Broadly Virtualization is divided into two categories:

(1) Platform virtualization: It involves the simulation of virtual machines, like server virtualization, desktop virtualization, etc. The operating system is abstracted from the hardware and is no longer bound to the architecture of the machine. There are several approaches to achieve platform virtualization-
       (a) Server virtualization
       (b) Client virtualization
       (c) Application virtualization

(2) Resource virtualization: It involves the simulation of combined, fragmented, or simplified resources, like storage virtualization, network virtualization, I/O virtualization, etc.


Server virtualization
Server virtualization makes it possible for the OS of a physical machine (Host) to run on a virtual layer (the Hypervisor*). This allows us to run multiple virtual machines (VMs) on the same physical machine. This physical machine with a virtualization layer is called 'Virtual host' or simply 'Host' and each guest OS running on the host is called Virtual Machines (VMs).

Server virtualization can be achieved by the following techniques:

       (i) Full-virtualization
       (ii) Paravirtualization /OS-Assisted virtualization
       (iii) Hardware-Assisted virtualization

Full virtualization:
  • Does dynamic binary translation/ rewriting
  • Creates emulation layer to emulate hardware
  • Virtual Machine Monitor (Hypervisor) traps and emulates privileged instructions1.
  • Examples- Hyper-V, VMware vSphere, QEMU, BOCHS, etc.
 

Native Privileged Architecture (Without visualization)


Full virtualization

Paravirtualization / OS-Assisted virtualization:
  • Guest OS is modified to process privileged instructions.
  • VMM is no longer required to translate instructions, it is only responsible for handling the virtualization layer.
  • Guest OS uses a specialized API to talk with VMM.
  • Example- Xen

Xen Paravirtualization

VMware Paravirtualization

Hardware-Assisted virtualization:
  • The VMM uses processor extension (Intel-VTx or AMD-V) to intercept and emulate privileged instructions.
  • Guest OS runs at kernel level (Ring 0)2 and VMM runs in a more privileged Ring than the Ring 0.

HW-Assisted virtualization
Intel-VTx HW virtualization

Privileged level /Ring: 


Privilege Ring



*Hypervisor: Hypervisor or Virtual Machine Monitor (VMM) is a software layer that allows several virtual machines to run on a single physical machine. There are two types of hypervisors or VMMs:



(i) Type-1 (Bare-Metal): It runs directly on the given hardware platform. It has complete control over the physical machines. Microsoft Hyper-V, VMWare ESX/ESXi, Citrix XenServer, IBM zVM, etc are type-1 hypervisors.



(ii) Type-2 (Hosted): It runs within an operating system environment. It is loaded on host OS as an application. VMWare Workstation, Microsoft Virtual PC, Sun virtual box, etc are type-2 hypervisors. 









Hyper-V

Microsoft Hyper-V is a type-1 hypervisor with a different implementation. The host OS is called a Parent partition and all VMs are called Child partitions.




A comparison with other type-1 hypervisors: