Saturday, November 3, 2012

Virtualization

Virtualization, the buzz word which we hear most these days in IT.

Virtualization, in computing, is the creation of a virtual (rather than actual) version of something, such as a hardware platform

Why Virtualization.?
  • Reduce the number of physical machines, thus reducing power consumption.
  • Increase space utilization efficiency in your data center.
  • Isolate environments but share hardware
  • Make better use of existing capacity
  • Virtualize Network and SAN interfaces to reduce infrastructure needs.
  • Ultimately save on maintenance and leases
Types
  • Full Virtualization
  • Para Virtualization
  • Hardware Assisted
The Hypervisor

The role of the Hypervisor is supporting Guest Operating Systems on a single machine.


Before going into Virtualization, there is one more concept which needs to be known, that is Security or Protection Rings in OS

Security / Protection Rings
  • Protection rings  is a mechanism to protect data and functionality from faults.
  • Computer operating systems provide different levels of access to resources.
  • Special gates exist between rings to allow outer ring to access inner rings resource is a predefined manner.

E.g. : A spyware program in ring 3 is not allowed to start web camera which is in ring 0.


Full Virtualization
  • In Full Virtualization Guest OS doesn’t know that it has been Virtualized, thinks it fully ‘owns’ the Hardware.
  • Uses a combination of binary translation and direct execution techniques.
  • Non-virtualizable instructions are translated into new sequences which have same intended effect in Virtual Hardware.
  • Guest OS is completely abstracted (decoupled) from under lying hardware by Virtualization layer.
  • Eg. VMWare ESX.


  • User Level code is directly executed on the Processor for high performance.
  • OS level sensitive calls are trapped by VM and executed.
  • Virtual machine monitor provides each Virtual Machine with all the services of the physical system, including virtual devices and virtualized memory management.
Para Virtualization
  • Also know as OS assisted Virtualization
  • Here the Guest OS knows that it has been modified to support Virtualization.
  • Non-virtualizable instructions are replaced by hyper calls that communicate  directly with virtualization layer.
  • It is relatively easy to modify guest OS to enable virtualization than to develop more sophisticated Full Virtualization.
  • E.g. :Xen


Installation Screen of SUSE Linux, asking to choose Server


Hardware Assisted Virtualization
  • Virtualization support is provided by Processors.
  • A privilege ring below “Ring 0” is added to support Virtualization.
  • All sensitive calls are set to automatically trap to the hypervisor, removing need for Full and Para Virtualization.


VMWare - Architecture

KVM - Architecture


Kernel Virtual Machine - KVM
  • KVM is relatively a new comer in Virtualization, but has changed the landscape of Virtualization.
  • Each guest OS is a single process of Host OS
  • A user-space program uses the /dev/kvm interface to set up the guest VM's address space
  • The approach that KVM takes is to turn a Linux kernel into a hypervisor simply by loading a kernel module.
  • The kernel module exports a device called /dev/kvm, which enables a guest mode of the kernel (in addition to the traditional kernel and user modes)
  • Supports Live Migration
  • A VM can be migrated from one Host to other in no time.
  • Guest is not involved.
  • Almost unnoticeable downtime.
  • VM image should be available on shared storage.
  • KVM introduces new process mode guest to existing user and kernel used for execution of guest OS code.
  • Guest mode exists to execute guest operating system code but only for code that's non-I/O.
  • Within guest mode are the standard two modes, so that a guest operating system runs in guest mode but supports the standard kernel and user modes for its kernel and user-space applications.
  • KVM mainly consists of two modules, KVM and QEMU.
  • KVM requires Intel-VT / AMD-SVM processor.

KVM
KVM module is used for Memory Virtualization.
Each guest operating system has its own address space that is mapped when the guest is instantiated.
The physical memory that is mapped for the guest operating system is actually virtual memory mapped into the process

QEMU
QEMU is used for I/O Virtualization.
QEMU is a platform virtualization solution that allows virtualization of an entire PC environment (including disks, graphic adapters, and network devices).
Any I/O requests a guest operating system makes are intercepted and routed to the user mode to be emulated by the QEMU process.

Other Virtualization Technologies
  • Xen, Bochs, UML, Linux-VServer, and coLinux.
  • VMWare
  • AIX – WPAR and VIOS
  • SUN – Zones and LDOMs
  • Microsoft – HyperV

No comments: