Introduction to KVM

KVM stands for Kernel Virtual Machine or rather Kernel based Virtual Machine.

This means that the virtual machine manager which actually manages the virtual machines is built into kernel itself unlike other virtual machine managers like virtualbox, vmplayer, etc which work on top of the OS - Windows or Linux.

Topic
Virtualbox
KVM
Xen
Company
Oracle
RedHat
Linux foundation
Intended user
Small medium business
Enterprise
Personal
Small Medium Business
Enterprise
Hypervisor type
Type 2
Type 2
Type 1 (Bare metal)
Virtualization type
Hardware assisted virtualization
Paravirtualization
Full virtualization
Hardware assisted virtualiation
Paravirtualization
Hardware assisted virtualization
paravirtualization
Architecture
x86
x64
x86
x64
Power
x86
x64
Supported storage
iSCSI, USB,Firewire, SAS
SATA,SCSI,PATA
USB
iSCSI
NFS
Virtual CPUs per VM
32
32
512
Virtual CPUs per host
128
16
512
Supported host OS
Fedora
Mac OS X
Solaris
RHEL
Ubuntu
Windows XP, 7,8.10
CentOS
Fedora
Mac OS X
Solaris
RHEL
Ubuntu
CentOS
Fedora
Mac OS X
Solaris
RHEL
Ubuntu
CentOS
Supported Guest OS
All
All
All Linux
No Windows
Price
Free
Free
Open source

Difference between KVM and QEMU

QEMU is a generic and open source machine emulator and virtualizer.  When used as a machine emulator, it can 

QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization. Though both use the same binary (qemu-system-x86_64), they differ in the hardware acceleration type.  In case of KVM, the acceleration type is "kvm" while in case of qemu, the hardware acceleration type is "tcg".

the key difference is that the Virtual CPU is actually emulated (or virtualized) by the hypervisor. Therefore, the hypervisor software has to translate the instructions meant for the Virtual CPU and convert it into instructions for the physical CPU. This translation has a big performance overhead. To minimize these overheads, modern processors  support virtualization extensions. Intel support a technology called VT-x and the AMD equivalent is AMD-V. Using these technologies, a slice of physical CPU can be directly mapped to the Virtual CPU. Hence the instructions meant for the Virtual CPU can be directly executed the physical CPU slice. 

KVM is the Linux kernel module that enables this mapping of physical CPU to Virtual CPU. This mapping provides the hardware acceleration for Virtual Machine and boosts its performance. Moreover, QEMU uses this acceleration when Virt Type is chosen as KVM.
Then what is TCG? If your server CPU does not support virtualization extension, then it is the job of the emulator (or hypervisor) to execute the Virtual CPU instruction using translation. QEMU uses TCG or Tiny Code Generator to optimally translate and execute the Virtual CPU instructions on the physical CPU.
QEMU and KVM by themselves are Type-2 hypervisors, but when QEMU uses KVM for hardware acceleation, then the combination becomes a Type-1 hypervisor. 

Comments

Popular posts from this blog

Amazon Scenario Questions

Using ssh keys to login to VMs

Accessing NATted VMs from Host machine using Port Forwarding