Virtual Machines &
Virtualization
Module-2
Implementation Levels of Virtualization
● Computer Architecture that allows multiple VMs to run on
the same machine
● Enhances resource sharing and improves performance
● Virtualization layer called “hypervisor” or VMM is used
● Virtualization can be done at various levels:
○ ISA level
○ Hardware level
○ OS level
○ Library support level
○ Application level
Implementation Levels of Virtualization
● Instruction Set Architecture Level:
○ emulating a given ISA by the ISA of the host machine
○ basic emulation method: code interpretation
○ An interpreter program interprets the source instructions to target
instructions one by one
○ this process is relatively slow as One source instruction may require
tens or hundreds of native target instructions
○ For better performance: dynamic binary translation
○ translates basic blocks of dynamic source instructions to target
instructions
Implementation Levels of Virtualization
● Hardware level:
○ virtualize a computer’s resources,such as its processors, memory, and
I/O devices
○ upgrade the hardware utilization rate by multiple users concurrently
Implementation Levels of Virtualization
● OS level:
○ refers to an abstraction layer between traditional OS and user
applications
○ creates isolated containers on a single physical server
○ Containers behave like real servers
○ helps to allocate hardware resources among a large number of mutually
distrusting users
○ helps in consolidating server hardware by moving services on separate
hosts into containers or VMs on one server
Implementation Levels of Virtualization
● Library support level:
○ controlling the communication link between applications and the rest
of a system through API hooks
○ The software tool WINE has implemented this approach to support
Windows applications on top of UNIX hosts
○ the vCUDA allows applications executing within VMs to leverage GPU
hardware acceleration
Implementation Levels of Virtualization
● User Application level:
○ virtualizes an application as a VM
○ most popular approach is to deploy high level language (HLL) VMs
○ Other forms of application-level virtualization: application
isolation (application sandboxing)
○ wrapping the application in a layer that is isolated from the host OS
and other applications
Merits of Levels of Virtualization
VMM Design Requirements
● A VMM adds a layer between Hardware and OS
● It manages the hardware resources of a computing system
● The 3 requirements of a VMM are:
● a VMM should provide an environment which is essentially
identical to the original machine for programs
● programs run in this environment should show, at worst,
only minor decreases in speed
● a VMM should be in complete control of the system
resources
Virtualization Structures and Tools
● Depending on the position of the virtualization layer,
there are three typical classes of VM architecture
○ the hypervisor architecture (VMM),
○ paravirtualization, and
○ host-based virtualization
Virtualization Structures and Tools
● hypervisor architecture:
○ supports hardware-level virtualization
○ hypervisor software sits directly between the physical hardware and
its OS
○ provides hypercalls for the guest OSes and applications
○ Depending on the functionality, a hypervisor can assume a
micro-kernel architecture like the Microsoft Hyper-V or
○ a monolithic hypervisor architecture like the VMware ESX for server
virtualization
Virtualization Structures and Tools
○ A micro-kernel hypervisor includes only the basic and unchanging
functions (such as physical memory management and processor
scheduling)
○ The device drivers and other changeable components are outside the
hypervisor
○ A monolithic hypervisor implements all the functions, including those
of the device drivers
○ the size of the hypervisor code of a micro-kernel hypervisor is
smaller than that of a monolithic hypervisor
Virtualization Structures and Tools
● Host-based virtualization:
○ installs a virtualization layer on top of the host OS
○ host OS is still responsible for managing the hardware
○ The guest OSes are installed and run on top of the virtualization
layer
○ Advantages:
■ the user can install this VM architecture without modifying the
host OS
■ Since host OS provides device drivers and other low-level
services, it will simplify the VM design and ease its deployment
■ appeals to many host machine configurations
Virtualization Structures and Tools
Virtualization Structures and Tools
● Para-virtualization architecture:
○ a virtualization layer is inserted between the hardware and the OS
○ modifies the guest operating systems
○ provides special APIs requiring substantial OS modifications
○ replaces non-virtualizable instructions with hypercalls that
communicate directly with the hypervisor or VMM
○ Eg. KVM
Virtualization Structures and Tools
Virtualization Structures and Tools
● Xen Architecture:
○ open source hypervisor program developed by Cambridge University
○ It is a microkernel hypervisor
○ provides a mechanism by which a guest OS can have direct access to
the physical devices
○ many guest OSes can run on top of the hypervisor
○ not all guest OSes are created equal, one OS in particular controls
the others
○ The guest OS, which has control ability, is called Domain 0
○ others are called Domain U
○ Domain 0 allows users to create, copy, save, read, modify, share,
migrate, and roll back VMs
Virtualization Structures and Tools
Virtualization Structures and Tools
● VMWare ESX:
○ Uses Para-virtualization architecture
○ a hypervisor for bare-metal x86 symmetric multiprocessing (SMP)
servers
○ consists of four components: a virtualization layer, a resource
manager, hardware interface components, and a service console
○ VM kernel interacts directly with the hardware without involving the
host OS
Virtualization Structures and Tools
○ The VMM layer virtualizes the physical hardware resources
such as CPU, memory, network and disk controllers, and human
interface devices
○ resource manager allocates CPU, memory disk, and network
bandwidth
○ Hardware interface components are the device drivers and the
VMware ESX Server File System
○ service console is responsible for booting the system,
initiating the execution of the VMM and resource manager,
and relinquishing control to those layers
Virtualization of CPU, Memory & I/O Devices
○ software-based virtualization techniques are complicated and
incur performance overhead
○ Intel provides a hardware-assist technique to make
virtualization easy and improve performance known as
“Hardware-Assisted Virtualization”
○ For processor virtualization: Intel offers the VT-x or VT-i
technique
○ For memory virtualization: Intel offers the EPT
○ For I/O virtualization, Intel implements VT-d and VT-c
Virtualization of CPU, Memory & I/O Devices
Virtualization of CPU, Memory & I/O Devices
○ CPU Virtualization:
■ A CPU architecture is virtualizable if
● VM’s privileged and unprivileged instructions runs in
the CPU’s user mode
● VMM runs in supervisor mode
■ not all CPU architectures are virtualizable
● RISC CPU architectures can be naturally virtualized
● x86 CPU architectures are not primarily designed to
support virtualization
Virtualization of CPU, Memory & I/O Devices
Virtualization of CPU, Memory & I/O Devices
○ Memory Virtualization:
■ In a traditional execution environment, the OS maintains
mappings of virtual memory to machine memory
■ In a virtual execution environment, a two-stage mapping
process should be maintained by the guest OS and the VMM
● Virtual memory to physical memory and
● physical memory to machine memory
■ The guest OS controls the mapping of virtual addresses to
the physical memory addresses of VMs
■ The VMM maps the guest physical memory to the actual
machine memory
Virtualization of CPU, Memory & I/O Devices
Virtualization of CPU, Memory & I/O Devices
○ I/O Virtualization:
■ involves managing the routing of I/O requests between
virtual devices and the shared physical hardware
■ Three ways to implement I/O virtualization:
● full device emulation,
● para-virtualization, and
● direct I/O
Virtualization of CPU, Memory & I/O Devices
○ I/O Virtualization:
■ Full Device Emulation:
● All the functions of a device are replicated in
software
● software is located in the VMM and acts as a virtual
device
● VMM which interacts with the I/O devices
Virtualization of CPU, Memory & I/O Devices
Virtualization of CPU, Memory & I/O Devices
○ I/O Virtualization:
■ Para-Virtualization:
● known as the split driver model consisting of a
frontend driver and a backend driver
● The frontend driver is running in Domain U
● The backend driver is running in Domain 0
● The frontend driver manages the I/O requests of the
guest OSes
● backend driver is responsible for managing the real
I/O devices and multiplexing the I/O data of
different VMs
Virtualization of CPU, Memory & I/O Devices
○ I/O Virtualization:
■ Direct I/O Virtualization:
● lets the VM access devices directly
● achieve close-to-native performance without high CPU
costs
● when a physical device is reclaimed, it may have been
set to an arbitrary state
● Hence can function incorrectly or even crash the
whole system
● Mainly focuses on networking for mainframes
Virtual Cluster and Resource Management
○ Physical cluster is a collection of servers (physical
machines) interconnected by a physical network
○ Virtual clusters are built with VMs installed at distributed
servers
○ virtual cluster is formed with physical machines or a VM
hosted by multiple physical clusters
○ VMs in a virtual cluster are interconnected logically by a
virtual network
Virtual Cluster and Resource Management
Virtual Cluster and Resource Management
○ Properties of virtual clusters:
■ The virtual cluster nodes can be either physical or
virtual machines
■ A VM runs with a guest OS, which is often different from
the host OS
■ VMs consolidate multiple functionalities on the same
server thereby enhancing server utilization
■ VMs can be colonized (replicated) in multiple servers
■ The size (number of nodes) of a virtual cluster can grow
or shrink dynamically
■ failure of VMs will not pull down the host system
Virtual Cluster and Resource Management
○ Virtual clusters essential features:
○ Fast Deployment and Effective Scheduling:
■ system should have the capability of fast deployment of
software stacks (OS, libraries, applications)
■ to quickly switch runtime environments from one user’s
virtual cluster to another user’s virtual cluster
Virtual Cluster and Resource Management
○ High-Performance Virtual Storage:
■ It is important to efficiently manage the disk spaces
occupied by template software packages
■ A template is a disk image that includes a preinstalled
operating system with or without certain application
software.
■ Templates implement the COW (Copy on Write) format
■ A new COW backup file is very small and easy to create
and transfer, reduces disk space consumption
Virtual Cluster and Resource Management
○ 3 critical design issues of virtual clusters:
■ live migration of VMs,
■ memory and file migrations
■ Network migration
○ Live Migration of VMs:
■ When a VM fails, its role could be replaced by another VM
on a different node
■ Advantage: enhanced failover flexibility
■ Drawback: a VM must stop playing its role if its residing
host node fails
Virtual Cluster and Resource Management
Virtual Cluster and Resource Management
○ Live Migration of VMs:
■ There are four ways to manage a virtual cluster:
● use a guest-based manager, by which the cluster
manager resides on a guest system
● Use a Host-based manager that supervises the guest
systems and can restart the guest system on another
physical machine
● use an independent cluster manager on both the host
and guest systems
● use an integrated cluster on the guest and host
systems.
Virtual Cluster and Resource Management
○ Memory Migration:
■ Moving the memory instance of a VM from one physical host
to another
■ It can be in a range of hundreds of MBs to a few GBs
■ The Internet Suspend-Resume (ISR) technique exploits
temporal locality: transmission of only those files which
have been changed since a VM was last suspended
○ File Migration:
■ In smart copying, the VMM exploits spatial locality:
transmit only the difference between the two file systems
at suspending and resuming locations
Virtual Cluster and Resource Management
○ Network Migration:
■ each VM assigned a virtual IP address known to other
entities
■ This address can be distinct from the IP address of the
host machine
■ Each VM can also have its own distinct virtual MAC
address
■ VMM maintains a mapping of the virtual IP and MAC
addresses to their corresponding VMs