Ccs335 Cc Unit II Cloud Computing Unit 2 Notes
Ccs335 Cc Unit II Cloud Computing Unit 2 Notes
UNIT II
VIRTUALIZATION BASICS
Virtual Machine:
machine, from the perspective of a system, is implemented by the underlying hardware alone, and
the ISA provides the interface between the system and the machine.
often of secondary importance compared to accurate functionality, while with code signed VMs,
performance (and power efficiency) are often major goals. In the figure, code signed VMs are
connected using dotted lines because their interface is typically at a lower level than other system
VMs.
Types of Virtual Machines : You can classify virtual machines into two types:
1. System 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.
2. Process Virtual Machine : 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.
Virtual Machine Language : It’s type of language which can be understood by different operating
systems. It is platform-independent. Just like to run any programming language (C, python, or
java) we need specific compiler that actually converts that code into system understandable code
(also known as byte code). The same virtual machine language works. If we want to use code that
can be executed on different types of operating systems like (Windows, Linux, etc) then virtual
machine language will be helpful.
HYPERVISOR:
2. Explain in detail about Hardware based Virtualization.(or)Give the Virtualization
Structure and Explain the various types of Virtualization.(May-2023)
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 is the software used for doing
virtualization also known as the VMM (Virtual Machine Monitor). The hypervisor software
provides two different structures of Virtualization namely Hosted structure (also called Type
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. Fig.
2.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.
✓ 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.
• That is emulator works by translating instructions from the guest platform to instructions
of the host platform. These instructions would include both processor oriented (add, sub,
jump etc.), and the I/O specific (IN/OUT) instructions for the devices. Although this
virtual machine architecture works fine in terms of simplicity and robustness, it has its
own pros and cons.
• The advantages of ISA are, it provides ease of implementation while dealing with multiple
platforms and it can easily provide infrastructure through which one can create virtual
machines based on x86 platforms such as Sparc and Alpha. The disadvantage of ISA is since
every instruction issued by the emulated computer needs to be interpreted in software first
which degrades the performance.
a) Boochs
It is a highly portable emulator that can be run on most popular platforms that include x86,
PowerPC, Alpha, Sun, and MIPS. It can be compiled to emulate most of the versions of x86
machines including 386, 486, Pentium, Pentium Pro or AMD64 CPU, including optional MMX, SSE,
SSE2, and 3DNow instructions.
b) QEMU
QEMU (Quick Emulator) is a fast processor emulator that uses a portable dynamic translator.
It supports two operating modes: user space only, and full system emulation. In the earlier mode,
QEMU can launch Linux processes compiled for one CPU on another CPU, or for cross-
compilation and cross-debugging. In the later mode, it can emulate a full system that includes
a processor and several peripheral devices. It supports emulation of a number of processor
architectures that includes x86, ARM, PowerPC, and Sparc.
c) Crusoe
The Crusoe processor comes with a dynamic x86 emulator, called code morphing engine
that can execute any x 86 based application on top of it. The Crusoe is designed to
handle the x86 ISA’s precise exception semantics without constraining speculative
scheduling. This is accomplished by shadowing all registers holding the x86 state.
d) BIRD
BIRD is an interpretation engine for x86 binaries that currently supports only x86 as the
host ISA and aims to extend for other architectures as well. It exploits the similarity between the
architectures and tries to execute as many instructions as possible on the native hardware.
All other instructions are supported through software emulation.
taking the similarities exist between them Virtualization technique helps map the virtual
resources to physical resources and use the native hardware for computations in the
virtual machine. This approach generates a virtual hardware environment which
virtualizes the computer resources like CPU, Memory and IO devices.
• For the successful working of HAL the VM must be able to trap every privileged instruction
execution and pass it to the underlying VMM, because multiple VMs running own OS might
issue privileged instructions need full attention of CPU’s .If it is not managed properly then
VM may issues trap rather than generating an exception that makes crashing of instruction
is sent to the VMM. However, the most popular platform, x86, is not fully-virtualizable,
because it is been observed that certain privileged instructions fail silently rather than
trapped when executed with insufficient privileges. Some of the popular HAL virtualization
tools are
a) VMware
The VMware products are targeted towards x86-based workstations and servers. Thus, it has
to deal with the complications that arise as x86 is not a fully-virtualizable architecture. The
VMware deals with this problem by using a patent-pending technology that dynamically rewrites
portions of the hosted machine code to insert traps wherever VMM intervention is required.
Although it solves the problem, it adds some overhead due to the translation and execution
costs. VMware tries to reduce the cost by caching the results and reusing them wherever
possible. Nevertheless, it again adds some caching cost that is hard to avoid.
b) Virtual PC
The Microsoft Virtual PC is based on the Virtual Machine Monitor (VMM) architecture that lets
user to create and configure one or more virtual machines. It provides most of the functions
same as VMware but additional functions include undo disk operation that lets the user easily
undo some previous operations on the hard disks of a VM. This enables easy data recovery
and might come handy in several circumstances.
c) Denali
The Denali project was developed at University of Washington’s to address this issue related
to scalability of VMs. They come up with a new virtualization architecture also called Para
• The operating system level virtualization is an abstraction layer between OS and user
applications. It supports multiple Operating Systems and applications to be run
simultaneously without required to reboot or dual boot. The degree of isolation of each OS
is very high and can be implemented at low risk with easy maintenance. The
implementation of operating system level virtualization includes, operating system
installation, application suites installation, network setup, and so on. Therefore, if the
required OS is same as the one on the physical machine then the user basically ends up
with duplication of most of the efforts, he/she has already invested in setting up the
physical machine. To run applications properly the operating system keeps the application
specific data structure, user level libraries, environmental settings and other requisites
separately.
• The key idea behind all the OS-level virtualization techniques is virtualization layer above
the OS produces a partition per virtual machine on demand that is a replica of the
operating environment on the physical machine. With a careful partitioning and
multiplexing technique, each VM can be able to export a full operating environment and
fairly isolated from one another and from the underlying physical machine.
• The popular OS level virtualization tools are
a) Jail
The Jail is a FreeBSD based virtualization software that provides the ability to partition an
operating system environment, while maintaining the simplicity of UNIX ”root”
model. The environments captured within a jail are typical system resources and data structures
such as processes, file system, network resources, etc. A process in a partition is referred to as “in
jail” process. When the system is booted up after a fresh install, no processes will be in jail. When
a process is placed in a jail, all of its descendants after the jail creation, along with itself, remain
within the jail. A process may not belong to more than one jail. Jails are created by a privileged
process when it invokes a special system call jail. Every call to jail creates a new jail; the only
way for a new process to enter the jail is by inheriting access to the jail from another process
that already in that jail.
b) Ensim
The Ensim virtualizes a server’s native operating system so that it can be partitioned into
isolated computing environments called virtual private servers. These virtual private servers
operate independently of each other, just like a dedicated server. It is commonly used in creating
hosting environment to allocate hardware resources among large number of distributed users.
Most of the system uses extensive set of Application Programmer Interfaces (APIs) instead of
legacy System calls to implement various libraries at user level. Such APIs are designed to hide
the operating system related details to keep it simpler for normal programmers. In this technique,
the virtual environment is created above OS layer and is mostly used to implement different
Application Binary Interface (ABI) and Application Programming Interface (API) using the
underlying system.
The example of Library Level Virtualization is WINE. The Wine is an implementation of the
Windows API, and can be used as a library to port Windows applications to UNIX. It is a
virtualization layer on top of X and UNIX to export the Windows API/ABI which allows to run
Windows binaries on top of it.
In this abstraction technique the operating systems and user-level programs executes like
applications for the machine. Therefore, specialize instructions are needed for hardware
manipulations like I/O mapped (manipulating the I/O) and Memory mapped (that is mapping
a chunk of memory to the I/O and then manipulating the memory). The group of such special
instructions constitutes the application called Application level Virtualization. The Java Virtual
Machine (JVM) is the popular example of application level virtualization which allows creating
a virtual machine at the application-level than OS level. It supports a new self-defined set of
instructions called java byte codes for JVM.
Such VMs pose little security threat to the system while letting the user to play with it like physical
machines. Like physical machine it has to provide an operating environment to its applications
either by hosting a commercial operating system, or by coming up with its own environment.
The comparison between different levels of virtualization is shown in Table 2.4.1.
Every hypervisor uses some mechanisms to control and manage virtualization strategies
that allow different operating systems such as Linux and Windows to be run on the same
physical machine, simultaneously. Depending on the position of the
virtualization layer, there are several classes of VM mechanisms, namely the binary translation,
para-virtualization, full virtualization, hardware assist virtualization and host-based
virtualization. The mechanisms of virtualization defined by VMware and other virtualization
providers are explained as follows.
virtualization. The binary translation mechanisms with full and host-based virtualization are
explained as follows.
a) Binary translation
In Binary translation of guest OS, The VMM runs at Ring 0 and the guest OS at Ring 1. The VMM
checks the instruction stream and identifies the privileged, control and behavior-sensitive
instructions. At the point 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. The binary translation mechanism is shown in Fig. 2.5.3.
b) Full Virtualization
In full virtualization, host OS doesn’t require any modification to its OS code. Instead it relies
on binary translation to virtualize the execution of some sensitive, non-virtualizable
instructions or execute trap. Most of the guest operating systems and their applications
composed of critical and noncritical instructions. These instructions are executed with the help
of binary translation mechanism.
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. In
a host- based virtualization, both host OS and guest OS takes part in virtualization where
virtualization software layer lies between them.
Therefore, full virtualization works with binary translation to perform direct execution of
instructions where guest OS is completely decoupled from the underlying hardware and
consequently, it is unaware that it is being virtualized.
The full virtualization gives degraded performance, because it involves binary translation of
instructions first rather than executing which is rather time-consuming. Specifically, the full
virtualization of I/O intensive applications is a really a big challenge as Binary translation
employs a code cache to store translated instructions to improve performance, however it
expands the cost of memory usage.
c) Host-based virtualization
In host-based virtualization, the virtualization layer runs on top of the host OS and guest
OS runs over the virtualization layer. Therefore, host OS is responsible for managing the
hardware and control the instructions executed by guest OS.
The host- based virtualization doesn’t require to modify the code in host OS but virtualization
software has to rely on the host OS to provide device drivers and other low-level services. This
architecture simplifies the VM design with ease of deployment but gives degraded performance
compared to other hypervisor architectures because of host OS interventions.
The host OS performs four layers of mapping during any IO request by guest OS or VMM
which downgrades performance significantly.
Para-Virtualization
The para-virtualization is one of the efficient virtualization techniques that require explicit
modification to the guest operating systems. The APIs are required for OS modifications in user
applications which are provided by para-virtualized VM.
In some of the virtualized system, performance degradation becomes the critical issue.
Therefore, para-virtualization attempts to reduce the virtualization overhead, and thus
improve performance by modifying only the guest OS kernel. The para-virtualization
architecture is shown in Fig. 2.5.4.
and emulating them at runtime, para-virtualization can handle such instructions at compile time.
In Para-Virtualization with Compiler Support thee guest OS kernel is modified to replace the
privileged and sensitive instructions with hypercalls to the hypervisor or VMM at compile
time itself. The Xen hypervisor assumes such para-virtualization architecture.
Here, guest OS running in a guest domain may run at Ring 1 instead of at Ring 0 that’s why
guest OS may not be able to execute some privileged and sensitive instructions. Therefore, such
privileged instructions are implemented by hypercalls to the hypervisor. So, after replacing the
instructions with hypercalls, the modified guest OS emulates the behavior of the original guest
OS.
Virtualization of CPU, Memory, And I/O Devices
5. Explain in detail about Virtualization of CPU, Memory, And I/O Devices.( Nov/Dec
2021)
Virtualization of CPU
The CPU Virtualization is related to range protection levels called rings in which code can
execute. The Intel x86 architecture of CPU offers four levels of privileges known as Ring 0, 1, 2
and 3.
Among that Ring 0, Ring 1 and Ring 2 are associated with operating system while Ring
3 is reserved for applications to manage access to the computer hardware. As Ring 0 is used
by kernel because of that Ring 0 has the highest-level privilege while Ring 3 has lowest privilege
as it belongs to user level application shown in Fig. 2.6.1.
The user level applications typically run in Ring 3, the operating system needs to have direct
access to the memory and hardware and must execute its privileged instructions in Ring 0.
Therefore, Virtualizingx86 architecture requires placing a virtualization layer under the
operating system to create and manage the virtual machines that delivers shared resources.
Some of the sensitive instructions can’t be virtualized as they have different semantics. If
virtualization is not provided then there is a difficulty in trapping and translating those sensitive
and privileged instructions at runtime which become the challenge. The x86 privilege level
architecture without virtualization is shown in Fig. 2.6.2.
In binary translation, the virtual machine issues privileged instructions contained within their
compile code. The VMM takes control on these instructions and changes the code under execution
to avoid the impact on state of the system. The full virtualization technique does not need to modify
host operating system. It relies on binary translation to trap and virtualize the execution of
certain instructions.
The noncritical instructions directly run on the hardware while critical instructions have to be
discovered first then they are replaced with
The para-virtualization technique refers to making communication between guest OS and the
that removes the need for either binary translation or para-virtualization. The Fig. 2.6.5 shows
Hardware Assisted Virtualization.
Virtualization Of Memory
6. Explain in detail bout virtualization of memory with an example.
Virtualization of Memory
The memory virtualization involves physical memory to be shared and dynamically allocated
to virtual machines. In a traditional execution environment, the operating system is
responsible for maintaining the mappings of virtual memory to machine memory using page
tables. The page table is a single-stage mapping from virtual memory to machine memory. All
recent x86 CPUs comprises built-in Memory Management Unit (MMU) and a Translation
Lookaside Buffer (TLB) to improve the virtual memory performance. However, in a virtual
execution environment, the mapping is required from virtual memory to physical memory and
physical memory to machine memory; hence it requires two-stage mapping process.
The modern OS provides virtual memory support that is similar to memory virtualization. The
Virtualized memory is seen by the applications as a contiguous address space which is not
tied to the underlying physical memory in the system. The operating system is responsible for
mappings the virtual page numbers to physical page numbers stored in page tables. To optimize
the Virtual memory performance all modern x86 CPUs include a Memory Management Unit
(MMU) and a Translation Lookaside Buffer (TLB). Therefore, to run multiple virtual machines
with Guest OS on a single system, the MMU has to be virtualized shown in Fig. 2.7.1.
The Guest OS is responsible for controlling the mapping of virtual addresses to the guest
memory physical addresses, but the Guest OS cannot have direct access to the actual machine
memory. The VMM is responsible for mapping the Guest physical memory to the actual
machine memory, and it uses shadow page tables to accelerate the mappings. The VMM uses
TLB (Translation Lookaside Buffer) hardware to map the virtual memory directly to the
machine memory to avoid the two levels of translation on every access. When the guest OS
changes the virtual memory to physical memory mapping, the VMM updates the shadow page
tables to enable a direct lookup. The hardware-assisted memory virtualization by AMD
processor provides hardware assistance to the two-stage address translation in a virtual
execution environment by
using a technology called nested paging.
The virtualization of devices and I/O’s is bit difficult than CPU virtualization. It involves
managing the routing of I/O requests between virtual devices and the shared physical
hardware. The software based I/O virtualization and management techniques can be used
for device and I/O virtualization to enables a rich set of features and simplified
management. The network is the integral component of the system which enables
communication between different VMs. The I/O virtualization provides virtual NICs and
switches that create virtual networks between the virtual machines without the network traffic
and consuming bandwidth on the physical network. The NIC teaming allows multiple physical
NICS to be appearing as one and provides failover transparency for virtual machines. It allows
virtual machines to be seamlessly relocated to different systems using VMware VMotion by
keeping their existing MAC addresses. The key for effective I/O virtualization is to preserve the
virtualization benefits with minimum CPU utilization. Fig. 2.7.2 shows device and I/O
virtualization.
The virtual devices shown in above Fig. 2.7.2 can be effectively emulate on well-
known hardware and can translate the virtual machine requests to the system hardware. The
standardize device drivers help for virtual machine standardization. The portability in I/O
Virtualization allows all the virtual machines across the platforms to be configured and run on
the same virtual hardware regardless of their actual physical hardware in the system. There are
three ways of implementing I/O virtualization. The full device emulation approach emulates
well-known real-world devices where all the functions of device such as enumeration,
identification, interrupt and DMA are replicated in software. The para-virtualization method of
IO virtualization uses split driver model that consist of frontend and backend drivers. The front-
end driver runs on Domain U which manages I/O request of guest OS. The backend driver
runs Domain 0 which manages real I/O devices with multiplexing of I/O data of different VMs.
They interact with each other via block of shared memory. The direct I/O virtualization let the
VM to access devices directly.it mainly focus on networking of mainframes. There are four
methods to implement I/O virtualization namely full device emulation, para- virtualization, and
direct I/O virtualization and through self-virtualized I/O.
In full device emulation, the IO devices are virtualized using emulation software. This method
can emulate all well-known and real-world devices. The emulation software is responsible for
performing all the functions of a devices or bus infrastructure, such as device enumeration,
identification, interrupts, and DMA which are replicated. The software runs inside the VMM
and acts as a virtual device. In this method, the I/O access
requests of the guest OS are trapped in the VMM which interacts with the I/O devices. The
multiple VMs share a single hardware device for running them concurrently. However, software
emulation consumes more time in IO access that’s why it runs much slower than the hardware it
emulates.
In para-virtualization method of I/O virtualization, the split driver model is used which
consist of frontend driver and backend driver. It is used in Xen hypervisor with different drivers
like Domain 0 and Domain U. The frontend driver runs in Domain U while backend driver runs in
Domain 0. Both the drivers interact with each other via a block of shared memory. The frontend
driver is responsible for managing the I/O requests of the guest OSes while backend driver is
responsible for managing the real I/O devices and multiplexing the I/O data of different VMs.
The para-virtualization method of I/O virtualization achieves better device performance than
full device emulation but with a higher CPU overhead.
In direct I/O virtualization, the virtual machines can access IO devices directly. It does not
have to rely on any emulator of VMM. It has capability to give better IO performance without high
CPU costs than para-virtualization method. It was designed for focusing on networking for
mainframes.
In self-virtualized I/O method, the rich resources of a multicore processor and harnessed
together. The self-virtualized I/O encapsulates all the tasks related with virtualizing an I/O
device. The virtual devices with associated access API to VMs and a management API to the
VMM are provided by self-virtualized I/O that defines one Virtual Interface (VIF) for every
kind of virtualized I/O device.
The virtualized I/O interfaces are virtual network interfaces, virtual block devices (disk),
virtual camera devices, and others. The guest OS interacts with the virtual interfaces via
device drivers. Each VIF carries a unique ID for identifying it in self- virtualized I/O and
consists of two message queues. One message queue for outgoing messages to the devices and
another is for incoming messages from the devices.
As there are a many of challenges associated with commodity hardware devices, the multiple
IO virtualization techniques need to be incorporated for eliminating those associated challenges
like system crash during reassignment of IO devices, incorrect functioning of IO devices and
high overhead of device emulation.
PART-A
1. “Although virtualization is widely accepted today; it does have its limits”. Comment on
the statement. (May-2021)
Although virtualization is widely accepted today; it does have its limitations that are
listed below.
• High upfront Investments : Organisations need to acquire resources beforehand to
implement Virtualization. Also, there might occur a need to incur additional resources
with time.
• Performance Issues : Although virtualization is an efficient technique and efficiency can
be increased by applying some techniques, there may be chances when the efficiency
is not as good as that of the actual physical systems.
• Licensing Issues : All software may not be supported on virtual platforms. Although
vendors are becoming aware of the increasing popularity of virtualization and have started
providing licenses for software to run on these platforms, the problem has not completely
vanished. Therefore, it is advised to check the licenses with the vendor before using
the software.
• Difficulty in Root Cause Analysis : With the addition of an additional layer in
virtualization, complexity gets increased. This increased complexity makes root cause
analysis difficult in case of unidentified problems.
2. List the requirements of VMM.(Nov/Dec 2021)
The requirements of VMM or hypervisor are
• VMM must support efficient task scheduling and resource allocation techniques.
• VMM should provide an environment for programs which is essentially identical to the
original physical machine.
• A VMM should be in complete control of the system resources.
• Any program run under a VMM should exhibit a function identical to that which it runs
on the original physical machine directly.
• VMM must be tightly related to the architectures of processors
3. Give the role of a VM. (or) Give the basic operations of a VM. (May-2017)
Virtualization allows running multiple operating systems on a single physical machine.
Each instance of operating system running inside called Virtual machine (VM). The main
role of VM is to allocate the host machine resources to run Operating system. The other roles of
VM are
• Provide virtual hardware, including CPUs, memory, storage, hard drives, network interfaces
and other devices to run virtual operating system.
• Provide fault and security isolation at the hardware level.
• Preserve performance with advanced resource controls.
• Save the entire state of a virtual machine to files.
• Move and copy virtual machines data as easily as like moving and copying files.
• Provision to migrate any virtual machine to any physical server.
6 VM permits us for installing other The containers are software that permits
software so virtually we control it as distinct application's functionalities
disputed to install the software on a independently.
computer directly.
7 Applications executing on virtual Applications executing within the
machine system can execute distinct container environment contribute to an
OS. individual OS.
8 VM facilitates a way for virtualizing Container only virtualizes the OS.
any computer system.
9 VMs have a large size. Containers are very light (some
megabytes).
10 VM runs in minutes due to its large Containers run in seconds.
size.
11 It utilizes a lot of memory of the Containers utilize very less system
system. memory.
12 It is highly secured. It is less secure.