UNIT 2
UNIT 2
With the introduction of new technologies and newer research models, a lot number of hardware
and software products are being launched. Many of the software are platform-dependent hence it is
sometimes difficult to debug or check them because of the limited hardware resources.
A VM (virtual machine) is an emulation of a computer system, where these machines use computer
architectures to provide the functionality of a physical computer. The physical device on which
virtual machines work is known as Host, whereas the virtual machines are known as Guest. A
single host can have multiple numbers of guests.
Virtualization
Virtualization is a proven software technology that makes it possible to run multiple operating
systems and applications on the same server at the same time. Example: Run both Windows and
Linux on the same machine
It is the creation of a virtual (rather than actual) version of something, such as an operating system,
a server, a storage device or network resources.
The virtual machine works like a computer, and it is sandboxed from the rest of the host system.
The software within the guest cannot make changes to the software of the host system. Thus, the
virus files can be tested using a virtual machine without affecting the main computer system. The
computer software that creates and runs the virtual machine is known as Hypervisor. Based on their
functions there are two different types of virtual machines – System virtual machines and process
virtual machines.
These types of VMs provide full virtualization. Acting as the substitute for the real machine, these
will provide functionalities to execute an entire operating system. Hardware resources are shared
and managed, forming multiple environments on the host system. These environments are isolated
from each other but exist on the same physical host. Thus, these provide time-sharing among
several single-tasking operating systems.
To allow memory sharing between different virtual machines on one computer operating system,
memory overcommitment systems can be applied. Memory pages having identical content can be
shared among multiple virtual machines present on the same physical host. This is highly useful for
read-only pages.
These types of virtual machines gives us complete system platform and gives the execution of
the complete virtual operating system. Just like virtual box, system virtual machine is
providing an environment for an OS to be installed completely. We can see in below image
that our hardware of Real Machine is being distributed between two simulated operating
systems by Virtual machine monitor. And then some programs, processes are going on in that
distributed hardware of simulated machines separately.
While process virtual machines, unlike system virtual machine, does not provide us with the
facility to install the virtual operating system completely. Rather it creates virtual environment of
that OS while using some app or program and this environment will be destroyed as soon as we
exit from that app. Like in below image, there are some apps running on main OS as well some
virtual machines are created to run other apps. This shows that as those programs required
different OS, process virtual machine provided them with that for the time being those programs
are running. Example – Wine software in Linux helps to run Windows applications.
Hypervisor
A hypervisor, also known as a virtual machine monitor or VMM. The hypervisor is a piece of
software that allows us to build and run virtual machines which are abbreviated as VMs.
A hypervisor allows a single host computer to support multiple virtual machines (VMs) by sharing
resources including memory and processing.
Hypervisors allow the use of more of a system's available resources and provide greater IT
versatility because the guest VMs are independent of the host hardware which is one of the major
benefits of the Hypervisor.
In other words, this implies that they can be quickly switched between servers. Since a hypervisor
with the help of its special feature, it allows several virtual machines to operate on a single physical
server. So, it helps us to reduce:
Kinds of hypervisors
There are two types of hypervisors: "Type 1" (also known as "bare metal") and "Type 2" (also
known as "hosted"). A type 1 hypervisor functions as a light operating system that operates directly
on the host's hardware, while a type 2 hypervisor functions as a software layer on top of an
operating system, similar to other computer programs.
Since they are isolated from the attack-prone operating system, bare-metal hypervisors are
extremely stable.
Furthermore, they are usually faster and more powerful than hosted hypervisors. For these
purposes, the majority of enterprise businesses opt for bare-metal hypervisors for their data center
computing requirements.
While hosted hypervisors run inside the OS, they can be topped with additional (and different)
operating systems.
The hosted hypervisors have longer latency than bare-metal hypervisors which is a very major
disadvantage of the it. This is due to the fact that contact between the hardware and the hypervisor
must go through the OS's extra layer.
The native or bare metal hypervisor, the Type 1 hypervisor is known by both names.
It replaces the host operating system, and the hypervisor schedules VM services directly to the
hardware.
The type 1 hypervisor is very much commonly used in the enterprise data center or other server-
based environments.
It includes KVM, Microsoft Hyper-V, and VMware vSphere. If we are running the updated version
of the hypervisor then we must have already got the KVM integrated into the Linux kernel in 2007.
It is also known as a hosted hypervisor, The type 2 hypervisor is a software layer or framework that
runs on a traditional operating system.
It operates by separating the guest and host operating systems. The host operating system schedules
VM services, which are then executed on the hardware.
Individual users who wish to operate multiple operating systems on a personal computer should use
a form 2 hypervisor.
This type of hypervisor also includes the virtual machines with it.
Hardware acceleration technology improves the processing speed of both bare-metal and hosted
hypervisors, allowing them to build and handle virtual resources more quickly.
On a single physical computer, all types of hypervisors will operate multiple virtual servers for
multiple tenants. Different businesses rent data space on various virtual servers from public cloud
service providers. One server can host multiple virtual servers, each of which is running different
workloads for different businesses.
Hypervisors are a key component of the technology that enables cloud computing since they are a
software layer that allows one host device to support several virtual machines at the same time.
Hypervisors allow IT to retain control over a cloud environment's infrastructure, processes, and
sensitive data while making cloud-based applications accessible to users in a virtual environment.
A hypervisor also helps in the rapid migration of applications to the cloud as being a part of a
virtualization platform.
As a result, businesses will take advantage of the cloud's many advantages, such as lower hardware
costs, improved accessibility, and increased scalability, for a quicker return on investment.
Benefits of hypervisors
o Speed: The hypervisors allow virtual machines to be built instantly unlike bare-metal
servers. This makes provisioning resources for complex workloads much simpler.
o Efficiency: Hypervisors that run multiple virtual machines on the resources of a single
physical machine often allow for more effective use of a single physical server.
o Flexibility: Since the hypervisor distinguishes the OS from the underlying hardware, the
program no longer relies on particular hardware devices or drivers, bare-metal hypervisors
enable operating systems and their related applications to operate on a variety of hardware
types.
o Portability: Multiple operating systems can run on the same physical server thanks to
hypervisors (host machine). The hypervisor's virtual machines are portable because they are
separate from the physical computer.
VIRTUALIZATION
• Virtualization hides the physical characteristics of computing resources from their users,
applications, or end users.
• This includes making a single physical resource (such as a server, an operating system, an
application, or storage device) appear to function as multiple virtual resources.
• It can also include making multiple physical resources (such as storage devices or
servers) appear as a single virtual resource.
• In computing, virtualization refers to the act of creating a virtual (rather than actual)
version of something, like computer hardware platforms, operating systems, storage
devices, and computer network resources
• Creation of a virtual machine over existing operating system and hardware.
Advantages of Virtualization:
1. Reduced Costs.
5. Increase Availability
6. Save energy
1. Extra Costs.
2. Software Licensing.
The idea is to separate the hardware from the software to yield better system efficiency. For
example, computer users gained access to much enlarged memory space when the concept of
virtual memory was introduced. Similarly, virtualization techniques can be applied to enhance
the use of compute engines, networks and storage.
A traditional computer runs with host operating system specially tailored for its hardware
architecture, as shown in Figure 2.11 (a). After virtualization, different user applications
managed by their own operating systems (guest OS) can run on the same hardware, independent
of the host OS.
This is often done by adding additional software, called a virtualization layer as shown in
Figure 2.11 (b). This virtualization layer is known as hypervisor or virtual machine monitor
(VMM) .The VMs are shown in the upper boxes, where applications run with their own guest OS
over the virtualized CPU, memory, and I/O resources. The main function of the software layer
for virtualization is to virtualize the physical hardware of a host machine into virtual resources to
be used by the VMs, exclusively. The virtualization software creates the abstraction of VMs by
Figure 2.11 The architecture of a computer system before and after Virtualization
Figure 2.12 Virtualization ranging from hardware to applications in five abstraction levels.
At the ISA level, virtualization is performed by emulating a given ISA by the ISA of the
host machine. For example, MIPS binary code can run on an x86-based host machine with the
help of ISA emulation. With this approach, it is possible to run a large amount of legacy binary
code written for various processors on any given new hardware host machine. Instruction set
emulation leads to virtual ISAs created on any hardware machine.
Hardware-level virtualization is performed right on top of the bare hardware. The idea is
to virtualize a computer’s resources, such as its processors, memory, and I/O devices. The
intention is to upgrade the hardware utilization rate by multiple users concurrently.
This refers to an abstraction layer between traditional OS and user applications. OS-level
virtualization creates isolated containers on a single physical server and the OS instances to
utilize the hardware and software in datacenters.
The containers behave like real servers. OS-level virtualization is commonly used in
creating virtual hosting environments to allocate hardware resources among a large number of
mutually distrusting users. It is also used, to a lesser extent, in consolidating server hardware by
moving services on separate hosts into containers or VMs on one server.
Most applications use APIs exported by user level libraries rather than using lengthy
system calls by the OS. Since most systems provide well documented APIs, such an interface
becomes another candidate for virtualization.
hardware acceleration.
User-Application Level:
One hardware component, such as the CPU, can be virtualized as several virtual copies.
Therefore, several traditional operating systems which are the same or different can sit on the
same set of hardware simultaneously.
• First, a VMM should provide an environment for programs which is essentially identical
to the original machine.
• Second, programs run in this environment should show, at worst, only minor decreases in
speed.
• The first is the ability to use a variable number of physical machines and VM instances
depending on the needs of a problem.
• The second challenge concerns the slow operation of instantiating new VMs.
Advantages of OS Extensions
(1) VMs at the operating system level have minimal startup/shutdown costs, low resource
requirements, and high scalability.
(2) For an OS-level VM, it is possible for a VM and its host environment to synchronize
state changes when necessary.
(1) All OS-level VMs on the same physical machine share a single operating system kernel
(2) The virtualization layer can be designed in a way that allows processes in VMs to
access as many resources of the host machine as possible, but never to modify them.
Virtualization support on the Windows-based platform is still in the research stage. The
Linux kernel offers an abstraction layer to allow software processes to work with and operate on
resources without knowing the hardware details. New hardware may need a new Linux kernel to
support. Therefore, different Linux platforms use patched kernels to provide special support for
extended functionality.
There are three typical classes of VM architecture. Before virtualization, the operating
system manages the hardware. After virtualization, a virtualization layer is inserted between the
hardware and the operating system. In such a case, the virtualization layer is responsible for
converting portions of the real hardware into virtual hardware. Therefore, different operating
systems such as Linux and Windows can run on the same physical machine, simultaneously.
Depending on the position of the virtualization layer, there are several classes of VM
architectures, namely the hypervisor architecture, para-virtualization, and host based
virtualization. The hypervisor is also known as the VMM (Virtual Machine Monitor). They both
perform the same virtualization operations.
The hypervisor supports hardware-level virtualization on bare metal devices like CPU,
memory, disk and network interfaces. The hypervisor software sits directly between the physical
hardware and its OS. This virtualization layer is referred to as either the VMM or the hypervisor.
The hypervisor 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 it can assume monolithic hypervisor architecture like the VMware ESX for server
virtualization. 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
aforementioned functions, including those of the device drivers.
Therefore, the size of the hypervisor code of a micro-kernel hypervisor is smaller than
that of a monolithic hypervisor. Essentially, a hypervisor must be able to convert physical
devices into virtual resources dedicated for the deployed VM to use.
The core components of a Xen system are the hypervisor, kernel, and applications. The
organization of the three components is important. Like other virtualization systems, many guest
OSes can run on top of the hypervisor. However, not all guest OSes are created equal, and one in
particular controls the others.
The guest OS, which has control ability, is called Domain 0, and the others are called
Domain U. Domain 0 is a privileged guest OS of Xen. It is first loaded when Xen boots without
any file system drivers being available. Domain 0 is designed to access hardware directly and
manage devices. Therefore, one of the responsibilities of Domain 0 is to allocate and map
hardware resources for the guest domains (the Domain U domains).
Full Virtualization:
With full virtualization, noncritical instructions run on the hardware directly while critical
instructions are discovered and replaced with traps into the VMM to be emulated by software.
Both the hypervisor and VMM approaches are considered full virtualization.
VMware puts the VMM at Ring 0 and the guest OS at Ring 1. The VMM scans the
instruction stream and identifies the privileged, control- and behavior-sensitive instructions.
When these instructions are identified, they are trapped into the VMM, which emulates the
behavior of these instructions.
Figure 2.13 Indirect execution of complex instructions via binary translation of guest OS
requests using the VMM plus direct execution of simpleinstructions on the same host.
The method used in this emulation is called binary translation. Therefore, full
virtualization combines binary translation and direct execution. The guest OS is completely
decoupled from the underlying hardware. Consequently, the guest OS is unaware that it is being
virtualized. Binary translation employs a code cache to store translated hot instructions to
improve performance, but it increases the cost of memory usage.
Host-Based Virtualization:
Compared to the hypervisor/VMM architecture, the performance of the host based architecture
may also be low. When an application requests hardware access, it involves four layers of
mapping which downgrades performance significantly.
The virtualization layer can be inserted at different positions in a machine software stack.
However, para-virtualization attempts to reduce the virtualization overhead, and thus improve
performance by modifying only the guest OS kernel. The guest operating systems are para-
virtualized. The traditional x86 processor offers four instruction execution rings: Rings 0,1, 2,
and 3. The lower the ring number, the higher the privilege of instruction being executed. The OS
is responsible for managing the hardware and the privileged instructions to execute at Ring 0,
while user-level applications run at Ring 3.
Para-Virtualization Architecture:
When the x86 processor is virtualized, a virtualization layer is inserted between the
hardware and the OS. According to the x86 ring definitions, the virtualization layer
should also be installed at Ring 0. The para-virtualization replaces non virtualizable
instructions with hyper calls that communicate directly with the hypervisor or VMM.
However, when the guest OS kernel is modified for virtualization, it can no longer run on
the hardware directly.
The guest OS kernel is modified to replace the privileged and sensitive instructions
with hyper calls to the hypervisor or VMM. Xen assumes such a para virtualization
architecture. The guest OS running in a guest domain may run at Ring 1instead of at Ring
0. This implies that the guest OS may not be able to execute some privileged and sensitive
instructions. The privileged instructions are implemented by hypercalls to the
hypervisor. After replacing the instructions with hyper calls, the modified guest OS
emulates the behavior of the original guest OS.
Hardware Support for Virtualization: Modern operating systems and processors permit
multiple processes to run simultaneously. If there is no protection mechanism in a
processor, all instructions from different processes will access the hardware directly and
cause a system crash. Therefore, all processors have at least two modes, user mode and
supervisor mode, to ensure controlled access of critical hardware. Instructions running in
supervisor mode are called privileged instructions.
CPU
Virtualization:
Memory Virtualization:
I/O
Virtualizatio
n:
I/O virtualization involves managing the routing of I/O requests between virtual devices
and the shared physical hardware. There are three ways to implement I/O virtualization:
• Para virtualization
• Direct I/O
Full device emulation is the first approach for I/O virtualization. Generally,
this approach emulates well known, real-world devices. All the functions of a device or bus
infrastructure, such as device enumeration, identification, interrupts, and DMA, are
replicated in software. This software is located in the VMM and acts as a virtual device.ll
The I/O access requests of the guest OS are trapped in the VMM which interacts with the
I/O devices.
Figure 2.17 Device emulation for I/O virtualization implemented inside the middle
layer that maps real I/O devices into the virtual devices for the guest device
driver to use.