cc unit 2 notes
cc unit 2 notes
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.
Virtual machine
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.
These types of VMs provide full virtualization. Acting as the substitute for the real
machine.
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.
These provide time-sharing among several single-tasking operating systems.
Identical content can be shared among multiple virtual machines.
This is highly useful for read-only pages.
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.
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.
Each instance of operating system called Virtual Machine (VM) and operating system
runs inside virtual machine is called guest operating system.
Depending on the position of the virtualization layer, there are two classes of VM
architectures, namely the hypervisor architectures like bare-metal or host- based.
The hypervisor software provides two different structures of Virtualization namely
Hosted structure (also called Type2 Virtualization) and Bare-Metal structure (also
called Type 1 Virtualization) .
In hosted structure, the guest OS and applications run on the top of base or host OS
with the help of VMM (called Hypervisor).
In this type, hypervisor has to rely on host OS for pass through permissions to access
hardware.
In many cases, hosted hypervisor needs emulator, which lies between guest OS and
VMM to translate the instructions in native format. The hosted structure is shown in
Fig. 2.2.1.
To implement Hosted structure, a base OS needs to be installed first over which VMM can
be installed. The hosted structure is simple solution to run multiple desktop OS
independently. Fig2.2.2 (a) and (b) shows Windows running on Linux base OS and
Linux running on Windows base OS using hosted Hypervisor.
The popular hosted hypervisors are QEMU, VMware Workstation, Microsoft Virtual PC,
Oracle VirtualBox etc.
The advantages of hosted structure are
It does not allow guest OS to directly access the hardware instead it has
to go through base OS, which increases resource overhead.
It has very slow and degraded virtual machines performance due to
relying on intermediate host OS for getting hardware access.
It doesn’t scale up beyond the limit.
In Bare-Metal Structure, the VMM can be directly installed on the top of Hardware,
therefore no intermediate host OS is needed. The VMM can directly communicate
with the hardware and does not rely on the host system for pass through permission
which results in better performance, scalability and stability. The Bare-Metal
structure is shown in Fig.2.2.3. (See Fig. 2.2.3 on next page).
Bare-metal virtualization is mostly used in enterprise data centers for getting the
advanced features like resource pooling, high availability, disaster recovery and
security.
The popular Bare-Metal Hypervisors are Citrix Xen Server, VMware ESXI and
Microsoft Hyper V.
The advantages of Bare-Metal structure are
After replacing the instructions with hyper calls, the modified guest OS emulates the
behavior of the original guest OS.
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.
• Host machine: The machine on which the virtual machine is created.
• Guest machine: virtual machines referred as a guest machine.
• Hypervisor: Hypervisor is a firmware or low-level program that acts as a Virtual
Machine Manager.
Advantages of Virtualization:
1.Reduced Costs.
5.Increase Availability
6.Save energy
Disadvantages of Virtualization:
1. Extra Costs.
2. Software Licensing.
Key Concepts
The ability to control the exe cution in transparent manner opens new possibilities for
delivering a secure, controlled execution environment.
The virtual machine represents an emulated environment in which the guest is
executed.
This level of indirection allows the virtual machine manager to control and filter the
activity of the guest, thus preventing some harmful operations from being performed.
Managed execution Virtualization of the execution environment not only allows
increased security, but a wider range of features also can be implemented.
In particular, sharing, aggregation, emulation, and isolation are the most relevant feature.
1.Sharing
Virtualization allows the creation of a separate computing environment within the same
host.
In this way it is possible to fully exploit the capabilities of a powerful guest, which would
otherwise be underutilized.
2.Aggregation
Not only is it possible to share physical resource among several guests but virtualization
also allows aggregation, which is the opposite process.
A group of separate hosts can be tied together and represented to guests as a single virtual host.
3.Emulation
Guest programs are executed within an environment that is controlled by the virtualization
layer, which ultimately is a program.This allows for controlling and tuning the environment that
is exposed to guests.
4.Isolation
Virtualization allows providing guests whether they are operating systems, applications, or other
entities with a completely separate environment, in which they are executed. • The guest
program performs its activity by interacting with an abstraction layer, which provides access to
the underlying resources.
VIRTUALIZATION STRUCTURE
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).
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.
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.
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).
2. Binary Translation with Full Virtualization:
When these instructions are identified, they are trapped into the VMM, which
emulates the behavior of these instructions.
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.
Figure 2.13 Indirect execution of complex instructions via binary translation of guest OS requests using
the VMM plus direct execution of simple instructions on the same host.
3.Host-Based Virtualization:
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.
First, its compatibility and portability may be in doubt, because it must support the
unmodified OS as well.
Second, the cost of maintaining para-virtualized OSes is high, because they may
require deep OS kernel modifications.
The KVM does the rest, which makes it simpler than the hypervisor that controls the
entire machine.
KVM is a hardware-assisted para-virtualization tool, which improves performance
and supports unmodified guest OSes such as Windows, Linux, Solaris, and other
UNIX variants.
Unlike the full virtualization architecture which intercepts and emulates privileged
and sensitive instructions at runtime, para-virtualization handles these instructions at
compile time.
The guest OS kernel is modified to replace the privileged and sensitive instructions
with hyper calls to the hypervisor or VMM.
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.
After replacing the instructions with hyper calls, the modified guest OS emulates the
behavior of the original guest OS.
IMPLEMENTATION LEVELS OF VIRTUALIZATION
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.
Levels of Virtualization:
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 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.
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.
The basic blocks can also be extended to program traces or super blocks to increase
translation efficiency.
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.
The software tool WINE has implemented this approach to support Windows
applications on top of UNIX hosts.
5.User-Application Level:
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.
With the help of VM technology, a new computing mode known as cloud computing is
emerging.
Cloud computing is transforming the computing landscape by shifting the hardware and
staffing costs of managing a computational center to third parties, just like banks.
However, cloud computing has at least two challenges.
• 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 on Linux or Windows Platforms
To support virtualization, processors such as the x86 employ a special running mode
and instructions, known as hardware-assisted virtualization.
In this way, the VMM and guest OS run in different modes and all sensitive
instructions of the guest OS and its applications are trapped in the VMM.
To save processor states, modes witching are completed by hardware. For the
x86architecture, Intel and AMD have proprietary technologies for hardware-
assisted virtualization.
Therefore, all processors have at least two modes, user mode and supervisor mode, to
ensure controlled access of critical hardware.
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:
• Full device emulation
• Para virtualization
• Direct I/O
The frontend driver is running in Domain U and the backend driver is running
in Domain 0.
The frontend driver manages the I/O requests of the guest OSes and the backend
driver is responsible for managing the real I/O devices and multiplexing the I/O data
of different VMs.
Although para I/O- virtualization achieves better device performance than full
device emulation, it comes with a higher CPU overhead.
3.Direct I/O
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.
virtualization in Multi-Core Processors: