Virtualization is the technology that turns physical hardware into flexible pools of resources, and so it is the foundation of cloud infrastructure.
Virtualization Fundamentals
Virtualization is the creation of a virtual version of a resource, so that one physical resource can be shared by many users or one resource can be made from many. The main kinds are server virtualization, in which one server runs many virtual machines, storage virtualization, in which many storage devices appear as one, network virtualization, in which a physical network supports many virtual ones, desktop virtualization, in which a desktop runs on a server, and application virtualization. Its benefits are higher use of hardware, lower cost, isolation between users, quick creation and copying of machines, easy backup and movement, and a better use of power and space.
Definition: Hypervisor. A software layer that creates and manages virtual machines on physical hardware, allocating processor, memory and storage to each and keeping them isolated from one another.
Hypervisors
A hypervisor, or virtual machine monitor, sits between the hardware and the virtual machines. A Type-1 hypervisor, also called bare-metal, runs directly on the hardware, without a host operating system. It is efficient and secure, and is used in data centres and clouds. Examples are VMware ESXi, Microsoft Hyper-V, Xen and KVM. A Type-2 hypervisor, also called hosted, runs as an application on a normal operating system. It is easy to install and is used on desktops for testing and learning, but it is slower since there is an extra layer. Examples are Oracle VirtualBox and VMware Workstation.
Virtual Machines
A virtual machine (VM) is a software computer with its own virtual CPU, memory, disk and network, running its own guest operating system. Many VMs run on one host, and each is isolated. A VM can be saved as an image, copied, paused and moved to another host, a process called live migration. Virtualization techniques include full virtualization, in which the guest is unaware that it is virtual, paravirtualization, in which the guest is changed to cooperate with the hypervisor for better speed, and hardware-assisted virtualization, in which processors such as Intel VT-x and AMD-V help.
Table 2.1: Type-1 and Type-2 hypervisors
| Feature | Type-1 (bare metal) | Type-2 (hosted) |
|---|---|---|
| Runs on | Hardware directly | Host operating system |
| Performance | High | Lower |
| Use | Data centres, clouds | Desktops, testing |
| Examples | ESXi, Hyper-V, KVM, Xen | VirtualBox, VMware Workstation |
Example 2.1: Capacity of a virtualized server
Problem: A server has 64 GB of memory and 32 CPU cores. Each virtual machine needs 4 GB and 2 cores. The hypervisor keeps 8 GB for itself. How many VMs can run?
Solution:
- Memory left = 64 - 8 = 56 GB, so 56 / 4 = 14 VMs by memory.
- Cores allow 32 / 2 = 16 VMs.
- The smaller number limits the count.
Result: 14 virtual machines can run, limited by memory.
mem, cores, reserve = 64, 32, 8
by_mem = (mem - reserve) // 4
by_cpu = cores // 2
print(by_mem, by_cpu, min(by_mem, by_cpu))
Output
14 16 14
Common mistakes
- Believing that a Type-2 hypervisor is suited for a production cloud.
- Allocating more memory to VMs than the host has, without a plan for over-commitment.
- Forgetting that all VMs share the host and are affected if it fails.
Key takeaways
- A hypervisor creates and manages virtual machines.
- Type-1 runs on hardware, Type-2 runs on an operating system.
- A VM has its own guest OS and is isolated from others.
- Live migration moves a running VM between hosts.
Practice questions
- What is a hypervisor?
- Distinguish Type-1 and Type-2 hypervisors.
- Name two Type-1 hypervisors.
Answers to the practice questions
- Software that creates and manages virtual machines on physical hardware.
- Type-1 runs directly on hardware, Type-2 runs as an application on a host operating system.
- VMware ESXi and KVM (also Hyper-V, Xen).
Sources
- Official BCA syllabus Cloud Computing, course code 25BCA405DS03, Unit II
