Unit Ii Virtualization Basics
Unit Ii Virtualization Basics
Unit Ii Virtualization Basics
Virtual Machine :
abstracts the hardware of our personal computer such as CPU, disk drives,
memory, NIC (Network Interface Card) etc, into many different execution
environments as per our requirements, hence giving us a feel that each
execution environment is a single computer. For example, VirtualBox.
It partially uses the hardware of your system (like CPU, RAM, disk space, etc.)
but its space is completely separated from your main system. Two virtual
machines don‟t interrupt in each other‟s working and functioning nor they can
access each other‟s space which gives an illusion that we are using totally
different hardware system. More detail at Virtual Machine.
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
Virtual Machine Language :
Types of Hypervisor –
TYPE-1 Hypervisor:
The hypervisor runs directly on the underlying host system. It is also known as
a “Native Hypervisor” or “Bare metal hypervisor”. It does not require any base
server operating system. It has direct access to hardware resources. Examples of
Type 1 hypervisors include VMware ESXi, Citrix XenServer, and Microsoft
Hyper-V hypervisor.
Pros: Such kinds of hypervisors are very efficient because they have direct
access to the physical hardware resources(like Cpu, Memory, Network, and
Physical storage). This causes the empowerment of the security because there is
nothing any kind of the third party resource so that attacker couldn‟t
compromise with anything.
Cons: One problem with Type-1 hypervisors is that they usually need a
dedicated separate machine to perform their operation and to instruct different
VMs and control the host hardware resources.
TYPE-2 Hypervisor:
A Host operating system runs on the underlying host system. It is also known as
„Hosted Hypervisor”. Such kind of hypervisors doesn‟t run directly over the
underlying hardware rather they run as an application in a Host system(physical
machine). Basically, the software is installed on an operating system.
Hypervisor asks the operating system to make hardware calls. An example of a
Type 2 hypervisor includes VMware Player or Parallels Desktop. Hosted
hypervisors are often found on endpoints like PCs. The type-2 hypervisor is
very useful for engineers, and security analysts (for checking malware, or
malicious source code and newly developed applications).
Pros: Such kind of hypervisors allows quick and easy access to a guest
Operating System alongside the host machine running. These hypervisors
usually come with additional useful features for guest machines. Such tools
enhance the coordination between the host machine and the guest machine.
Cons: Here there is no direct access to the physical hardware resources so the
efficiency of these hypervisors lags in performance as compared to the type-1
hypervisors, and potential security risks are also there an attacker can
compromise the security weakness if there is access to the host operating system
so he can also access the guest operating system.
DISPATCHER:
The dispatcher behaves like the entry point of the monitor and reroutes the
instructions of the virtual machine instance to one of the other two modules.
ALLOCATOR:
The allocator is responsible for deciding the system resources to be provided to
the virtual machine instance. It means whenever a virtual machine tries to
execute an instruction that results in changing the machine resources associated
with the virtual machine, the allocator is invoked by the dispatcher.
INTERPRETER:
The interpreter module consists of interpreter routines. These are executed,
whenever a virtual machine executes a privileged instruction.
Choosing the right hypervisor :
Type 1 hypervisors offer much better performance than Type 2 ones because
there‟s no middle layer, making them the logical choice for mission-critical
applications and workloads. But that‟s not to say that hosted hypervisors don‟t
have their place – they‟re much simpler to set up, so they‟re a good bet if, say,
you need to deploy a test environment quickly. One of the best ways to
determine which hypervisor meets your needs is to compare their performance
metrics. These include CPU overhead, the amount of maximum host and guest
memory, and support for virtual processors.
Key Concepts –
Virtualization structure
Host Machine: The machine on which the virtual machine is going to be built is
known as Host Machine.
Benefits of Virtualization
Drawback of Virtualization
High Initial Investment: Clouds have a very high initial investment, but it is
also true that it will help in reducing the cost of companies.
Risk of Data: Hosting data on third-party resources can lead to putting the data
at risk, it has the chance of getting attacked by any hacker or cracker very
easily.
Characteristics of Virtualization
Types of Virtualization
Application Virtualization
Network Virtualization
Desktop Virtualization
Storage Virtualization
Server Virtualization
Data virtualization
Types of Virtualization
Uses of Virtualization
Data-integration
Business-integration
Service-oriented architecture data-services
Searching organizational data
Implementation levels of virtualization
A traditional computer runs with a host operating system specially tailored for
its hardware architecture, as shown in Figure 3.1(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
3.1(b). This virtualization layer is known as hypervisor or virtual machine
monitor (VMM) [54]. 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. This can be implemented at various operational levels, as we
will discuss shortly. The virtualization software creates the abstraction of VMs
by interposing a virtualization layer at various levels of a computer system.
Common virtualization layers include the instruction set architecture
(ISA) level, hardware level, operating system level, library support level, and
application level (see Figure 3.2).
1. Instruction Set Architecture Level
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.
Virtualization with library interfaces is possible by 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. Another example is the vCUDA
which allows applications executing within VMs to leverage GPU hardware
acceleration. This approach is detailed in Section 3.1.4.
5. User-Application Level
The number of X‟s in the table cells reflects the advantage points of each
implementation level. Five X‟s implies the best case and one X implies the
worst case. Overall, hardware and OS support will yield the highest
performance. However, the hardware and application levels are also the most
expensive to implement. User isolation is the most difficult to achieve. ISA
implementation offers the best application flexibility.
Full Virtualization
Paravirtualization
Hypercalls are similar to kernel system calls. They allow the guest OS to
communicate with the hypervisor.
In this article, you will learn about the difference between Full
Virtualization and Paravirtualization in the operating system. But before
discussing the differences, you must know about Full Virtualization and
Paravirtualization in the operating system.
What is Full Virtualization?
ESXi, VMWare, and Microsoft virtual servers are the technologies that provide
full virtualization capabilities. When an OS instruction is created, the hypervisor
immediately translates it during run-time and stores the result for future
reference. At the same time, the user-level instructions are run without changes
at native speed.
Although the primary goal of storing the translated instructions during binary
translation is to improve performance, it may raise the cost of memory usage.
Binary translation is another drawback of full virtualization because it consumes
a lot of time and may get a huge performance overhead. I/O intensive apps are
complicated to use in full virtualization.
What is Paravirtualization?
The interaction of the guest operating system with the hypervisor to improve
performance and productivity is known as paravirtualization. Unlike full
virtualization, paravirtualization does not achieve full isolation; instead, the
approach implements partial isolation. It also alters the operating system kernel
to use hypercalls rather than non-virtualizable instructions. The goal of
hypercalls is to communicate with the virtualization layer hypervisor directly.
However, most userspace workloads gain relatively little and achieve near-
native performance that is not reached for all workloads. Moreover, it is little
compatible and portable because it doesn't support the unmodified operating
system. It may also cause specific critical support and maintainability issues in
the production environment due to the requirement for extensive OS kernel
modifications.
Here, you will learn about the various key differences between Full
Virtualization and Paravirtualization multitasking in operating systems. Some
main differences between Full
Virtualization and Paravirtualization multitasking in operating systems are as
follows:
HARDWARE VIRTUALIZATION
Type-I hypervisors:
Hypervisors of type I run directly on top of the hardware. As a result, they stand
in for operating systems and communicate directly with the ISA interface
offered by the underlying hardware, which they replicate to allow guest
operating systems to be managed. Because it runs natively on hardware, this
sort of hypervisor is also known as a native virtual machine.
Type-II hypervisors:
To deliver virtualization services, Type II hypervisors require the assistance of
an operating system. This means they‟re operating system-managed
applications that communicate with it via the ABI and simulate the ISA of
virtual hardware for guest operating systems. Because it is housed within an
operating system, this form of hypervisor is also known as a hosted virtual
machine.
Although x86 processors are not virtualizable primarily, great effort is taken to
virtualize them. They are used widely in comparing RISC processors that the
bulk of x86-based legacy systems cannot discard easily. Virtuali-zation of x86
processors is detailed in the following sections. Intel‟s VT-x technology is an
example of hardware-assisted virtualization, as shown in Figure 3.11. Intel calls
the privilege level of x86 processors the VMX Root Mode. In order to control
the start and stop of a VM and allocate a memory page to maintain the
CPU state for VMs, a set of additional instructions is added. At the time of this
writing, Xen, VMware, and the Microsoft Virtual PC all implement their
hypervisors by using the VT-x technology.
3. Memory Virtualization
Since each page table of the guest OSes has a separate page table in the VMM
corresponding to it, the VMM page table is called the shadow page table.
Nested page tables add another layer of indirection to virtual memory. The
MMU already handles virtual-to-physical translations as defined by the OS.
Then the physical memory addresses are translated to machine addresses using
another set of page tables defined by the hypervisor. Since modern operating
systems maintain a set of page tables for every process, the shadow page tables
will get flooded. Consequently, the perfor-mance overhead and cost of memory
will be very high.