0% found this document useful (0 votes)
15 views19 pages

Unit 2 - Notes

This document provides an overview of virtualization, explaining what virtual machines (VMs) are, how they operate, and their benefits and disadvantages. It details the types of hypervisors, virtualization levels, and compares virtualization with cloud computing. Additionally, it discusses various virtualization techniques and their implementations, including full virtualization, paravirtualization, and memory and I/O virtualization.

Uploaded by

jebersonyabez9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views19 pages

Unit 2 - Notes

This document provides an overview of virtualization, explaining what virtual machines (VMs) are, how they operate, and their benefits and disadvantages. It details the types of hypervisors, virtualization levels, and compares virtualization with cloud computing. Additionally, it discusses various virtualization techniques and their implementations, including full virtualization, paravirtualization, and memory and I/O virtualization.

Uploaded by

jebersonyabez9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT 2

VIRTUALIZATION BASICS
Virtual Machine Basics
What is a Virtual Machine (VM)?
• A Virtual Machine (VM) is like a computer inside another computer.
• It has its own CPU, memory, storage, and network, but it’s created using software on
a physical machine.
Example: On your laptop, you can run Windows and also create a VM to run Linux at the
same time.
Multiple VMs on One Physical Machine
On a single physical computer:
• Many virtual machines can run at the same time
• Each VM has its own operating system
• Each VM runs its own applications
They work independently without disturbing each other.
How a Virtual Machine Works
1. At the bottom, there is a physical machine (real CPU, memory, disk, network).
2. On top of it, a hypervisor (virtualization software) is installed.
3. The hypervisor creates virtual hardware.
4. An operating system (Windows/Linux) is installed on each virtual hardware.
5. Applications run as if they are on a real computer.
Example: Physical computer → School building
Virtual machines → Different classrooms
Each classroom works separately but uses the same building
VM Architecture
Each program feels like it is using the entire computer.
Users work as if they have their own private system.
Actually, many virtual systems share the same physical hardware.
Benefits of Virtual Machines
• Each VM has its own memory space.
• One VM does not affect another VM.
• Data is secure and isolated.
• Multiple operating systems can run on one machine.
• Cost is reduced by using one powerful server instead of many small servers.

Fig: virtual Machine


Disadvantages of Virtual Machines
• VMs are slightly slower than physical machines.
• If the host machine has security problems, VMs may be affected.
• Some hardware devices are hard to access directly.
• Each VM needs its own OS files, so it uses more storage.

Taxonomy of Virtual Machines


What is Virtualization?
• Virtualization means using one physical computer to run many virtual computers
(VMs) at the same time.
• Each virtual machine acts like a separate computer with its own operating system and
applications.
• A special software called the Hypervisor (Virtual Machine Monitor, VMM) manages
this process.
Before vs After Virtualization
User Application → Host Operating System → Computer Hardware
• Only one OS controls the hardware.
• Applications depend on that single OS.
Example: A laptop with Windows installed can only run Windows apps.
Fig: Before Virtualization
After Virtualization
Applications → Virtual Machines → Guest OS → Hypervisor (VMM) → Hardware
• Hypervisor sits between hardware and OS.
• Multiple guest OSes (Windows, Linux, etc.) run side by side.
• Each VM thinks it has its own hardware.
Example: Using VMware to run both Windows and Linux on the same laptop.

Fig: After Virtualization


Main Categories of Virtualization
There are two main types:
1. Platform Virtualization
Creates full virtual machines
Each VM runs its own OS
2. Resource Virtualization
Virtualizes storage, network, memory, CPU, etc.
Combines or splits resources as needed

Fig: Taxonomy of Virtualization


The diagram answers two questions:
1. What is virtualized?
• Execution environment (virtual machines)
• Storage
• Network
2. How is virtualization done?
• Application-level virtualization (language-based VMs)
• Process-level virtualization
• System-level virtualization
• Hardware-assisted virtualization
Virtualization Levels:
Level 1: Application Level
• Runs at programming language level
• Example: Java Virtual Machine (JVM)
Level 2: Process Level
• Runs on top of an existing OS
• Each application feels isolated
Level 3: System Level
• Runs directly on hardware
• Creates full virtual machines
• Example: VMware, VirtualBox
Process-Level vs System-Level
Process-Level Virtualization
• Runs on top of an OS
• Virtualizes applications or processes only
• Example: JVM
System-Level Virtualization
• Runs directly on hardware
• Virtualizes entire machine (OS + apps)
• Example: VMware, VirtualBox
Virtualization vs Cloud Computing

Virtualization Cloud Computing

Runs multiple VMs on one physical machine Runs VMs over the internet

VM tied to a specific host VM can be on any host worldwide

Storage is persistent Storage is temporary

Customizable resources Standard resources

Recovery from failures: attempt to recover failed Recovery = discard and create new
VM VM

Pros of Virtualization
• Saves energy and space in data centers.
• Reduces IT costs.
• Easier resource management.
• VMs are isolated (safe from each other).
• Less downtime and better performance.
Cons of Virtualization
• Not all hardware/software supports it.
• Some applications don’t work well in virtualized environments.
Hypervisor
What is a Hypervisor?
A hypervisor is a software that allows many operating systems to run on one physical
computer.
It sits between the hardware and virtual machines and shares hardware resources like CPU,
memory and storage.
In Short
• One physical computer
• Many virtual machines (VMs)
• Each VM has its own operating system
• Hypervisor controls and manages them
A tool called VMM (Virtual Machine Manager) is used to create, start, stop and manage
VMs.

Type 1 Hypervisor (Bare-Metal)


Definition
A Type 1 hypervisor runs directly on the hardware without any host operating system.

Fig: Type 1 Hypervisor


Hardware → Hypervisor → Guest Operating Systems
• Runs directly on the hardware (no host OS in between).
• Very efficient and secure.
• Used in data centers and enterprise servers.
• Hardware at the bottom.
• Hypervisor directly controls it.
• Guest OS run above the hypervisor.
Type 2 Hypervisor
Definition
A Type 2 hypervisor runs on top of an existing operating system.
• Runs on top of an existing operating system (like Windows, Linux, macOS).
• Easier to install and use, but less efficient.
• Problems in the host OS affect all VMs.
Example: VMware Workstation, Oracle VirtualBox.

Fig: Type 2 Hypervisor


Hardware → Host Operating System → Hypervisor → Guest Operating Systems
• Hardware at the bottom.
• Host OS (like Windows) runs first.
• Hypervisor runs inside the host OS.
• Guest OS run above the hypervisor.
The hypervisor depends on the host OS. If the host OS crashes, all VMs are affected.
Differences Between Type 1 and Type 2

Type 1 (Bare-metal) Type 2 (Hosted)

Runs directly on hardware Runs on top of host OS

More secure & efficient Easier to install, but slower

Used in servers/data centers Used in personal computers/testing

Independent of host OS Dependent on host OS

Paravirtualization
What is Paravirtualization?
Paravirtualization is a type of virtualization where the guest operating system knows that it is
running inside a virtual machine and co-operates with the hypervisor.
Instead of pretending the hardware is real, the guest OS uses special calls (called hypercalls)
to talk directly to the hypervisor.
This cooperation makes the system faster and more efficient compared to full virtualization
Full virtualization → Guest OS does not know it is virtual
Paravirtualization → Guest OS knows it is virtual
Hypercalls
• Some CPU instructions cannot be virtualized safely.
• In paravirtualization, those instructions are replaced with hypercalls.
• A hypercall is like a shortcut request from the guest OS to the hypervisor.
• The hypervisor then handles important tasks like:
o Memory management
o Interrupt handling
o Time keeping
• Normal OS → system call → hardware
• Paravirtualized OS → hypercall → hypervisor → hardware
Fig: Paravirtualization Architecture
Hardware (CPU, memory, storage, network)
Operating system / Hypervisor layer (modified to support hypercalls)
Private servers (VMs) – multiple guest environments running above
Many private servers run on one modified OS and communicate with the hypervisor using
hypercalls.
Why Paravirtualization is Faster?
• Guest OS and hypervisor work together
• No need to pretend hardware is real
• Less overhead → better performance
Examples of Paravirtualization
• Xen – Open-source solution, uses hypercalls for near-native performance.
• Microsoft Virtual PC – A paravirtualization approach.
• User-mode Linux (UML) – Open-source solution.
• Cooperative Linux – Two OSes share hardware cooperatively.
• Linux KVM – Built into Linux kernel, supports both paravirtualization and full
virtualization.
Advantages
• Faster than full virtualization
• Better performance
• Efficient memory and CPU usage
Limitations
• Guest OS must be modified
• Cannot run directly on real hardware
• Different systems may not be compatible

IMPLEMENTATION LEVELS OF VIRTUALIZATION


Virtualization can happen at different levels. The lower levels are closer to hardware, the
upper levels are closer to applications.
Virtualization can be done at 5 levels
[Link] set Architecture level
2. Hardware Abstraction level
3. Operating System level
4. Library Support level
5. User Application level
1. ISA (Instruction Set Architecture) Level
One computer pretends to be another CPU.
• Every CPU understands its own instruction set (machine language).
• ISA virtualization translates one CPU’s instructions into another CPU’s instructions.
Example:
• Running MIPS programs on an x86 computer
• Running ARM apps on a PC using emulation
Working Principle:
• The system reads each instruction
• Converts it into instructions the real CPU understands

Fig: ISA emulation


ISA virtualization allows programs made for one CPU to run on a different CPU
using instruction translation.
Drawback of ISA
Slow, because every instruction must be translated.
2. Hardware Abstraction level (Hypervisor Level)
One real computer is split into many virtual computers.
• A hypervisor sits directly on the hardware
• It creates many virtual machines (VMs)
• Each VM has its own OS
Example:
• VMware
• Xen
• VirtualBox
Hardware virtualization uses a hypervisor to divide one physical machine into many
virtual machines.
Advantage:
• Can run different operating systems
• Strong isolation
3. Operating System level (Containers)
One OS creates many isolated environments instead of full VMs.
• All containers share the same OS kernel
• Each container behaves like a separate server
Examples:
Docker

• One OS kernel creates many isolated environments (containers).


• Each container looks like a separate server with its own processes, files, and network.
• They all share the same OS kernel.
• Advantage: Very fast, low overhead, high density.
• Limitation: All containers must use the same OS type.

[Link] Support level (ABI Virtualization)


Applications run without installing a full OS, using special libraries.
o System calls are intercepted and converted
o No full VM is required
Example: Wine (runs Windows apps on Linux)
Library-level virtualization lets foreign applications run by translating system calls.
Advantage:
Lightweight
Easy to implement
Limitation:
Not all applications work
Weak isolation

5. User Application Level Virtualization (Process Level)

Each application behaves like it has its own mini-computer.


• App runs in isolation
• Files and settings are stored virtually
• App can be moved easily
Example:
• Portable apps
• Java Virtual Machine (JVM)
High-Level Language VM:
• Java programs run inside JVM
• Same program runs on any OS
Application-level virtualization runs apps in isolation without installing them normally.
Benefits:
• Portable applications
• Easy migration
Limitation:
• Slower than native apps
• Not all apps can be virtualized
Comparison Table

Level What is Virtualized Example

ISA CPU instructions Emulator

Hardware Full computer VMware, Xen

OS User spaces Docker

Library System calls Wine

Application Individual apps JVM

VIRTUALIZATION TYPES
Virtualization – Definition
Virtualization is a technique that allows a single physical machine (computer/server) to run
multiple operating systems (OS) at the same time by creating Virtual Machines (VMs).
Each VM behaves like a real computer with:
• CPU
• Memory (RAM)
• Storage (Hard disk)
• Network
• OS and applications
Purpose:
• Efficient use of hardware
• Run multiple OS in same system
• Reduce cost and power usage
• Easy resource management
Virtual Machine (VM) and Hypervisor
Virtual Machine (VM)
A Virtual Machine is a software-based computer created inside a physical computer.
It runs its own Guest OS.
Hypervisor / VMM (Virtual Machine Monitor)
Hypervisor is a software layer that:
• creates and manages VMs
• allocates CPU, memory, storage to VMs
• provides isolation and security
VM architecture view
Guest OS + Apps → Virtualization layer → Hardware
TYPES OF VIRTUALIZATION
1. Full Virtualization
Full Virtualization provides a complete virtual environment where the Guest OS runs without
any modification.
Guest OS thinks it is running on a real computer.
Working Principle
Hypervisor uses:
Binary Translation- Binary Translation is a technique used in full virtualization in which the
hypervisor dynamically converts (translates) privileged or sensitive instructions of the guest
operating system into safe instructions, so that the guest OS can run without modification on
virtual hardware.

Trap-and-Execute- Trap-and-Execute is a virtualization technique in which privileged


instructions executed by the guest OS cause a trap (CPU exception), transferring control to
the hypervisor, which then executes the instruction safely and returns control back to the
virtual machine.
Meaning:
• Some OS instructions are not safe to run directly
• Hypervisor captures them and executes safely
Features
• Guest OS does not know it is virtualized
• Hypervisor controls all hardware access
• Supports running multiple OS on same server
Advantages
[Link] need to modify guest OS
[Link] many operating systems
[Link] installation and usage
Disadvantages
[Link] performance overhead because translation takes time
2. Requires more resources than other methods
Examples
• VMware Workstation
• VMware ESXi
• Microsoft Virtual Server
[Link]-Based Virtualization
In Host-based virtualization, virtualization software runs on top of an existing Host
Operating System.
Example:
Windows (Host OS) + VirtualBox → Ubuntu VM
Architecture
Hardware → Host OS → Hypervisor (software) → Guest OS (VMs)
Advantages
Easy installation
No need to modify host OS
Works on different hardware setups
Good for lab and personal use
Disadvantages

Performance depends on host OS


Not best for large enterprise servers

3. Memory Virtualization
Memory virtualization is the method of providing virtual memory (RAM) to each VM so that
every VM believes it has its own RAM.
Why Memory Virtualization is Needed?
Because many VMs run on a single machine and share physical RAM.
So the hypervisor maps:
Guest virtual memory → physical machine memory
• Memory is divided into blocks called pages (example 4 KB)
• Hypervisor performs page mapping and memory protection
• Each VM has isolation in memory usage
Advantages
Efficient use of RAM
Better isolation and security
Supports VM migration and fault tolerance
Disadvantages
If too many VMs run, performance reduces
Memory management becomes complex
4.I/O Virtualization
I/O virtualization means sharing input/output devices like:
• keyboard
• mouse
• disk
• USB
• network card
between multiple virtual machines safely.

Fig: I/O Virtualization


Why I/O Virtualization is Needed?
Because many VMs cannot directly use one device at the same time.
So the hypervisor manages access.
Methods of I/O Virtualization
(a) Full Device Emulation
Hypervisor creates a virtual device that looks like a real device.
Guest OS uses standard drivers.
No change needed in Guest OS.
Example:
VM thinks it has its own network card, but it’s emulated.
Advantage:
• Compatibility is high
Disadvantage:
• Slower performance due to emulation.
(b) Para-Virtualization
Guest OS works closely with hypervisor using:
Hypercalls
Hypercall = special call from Guest OS to hypervisor.
Advantage:
• Better performance than full emulation
Disadvantage:
• Guest OS must be modified
(c) Direct I/O Virtualization
Here VM gets near-direct access to the device hardware.
Advantage:
• Highest performance (fast)
• Lower overhead
Disadvantage:
• Hardware dependency
• Not suitable for all devices
[Link] Virtualization
CPU virtualization means providing each VM a virtual CPU so that multiple VMs share the
physical processor.
How it works?
• Hypervisor schedules CPU time for each VM
• Each VM executes instructions in its own environment
Hardware Support for CPU Virtualization
Modern CPUs provide support such as:
Intel VT (Virtualization Technology)
Advantages
Better speed than software translation
Efficient multi-VM execution
Reduced complexity
6. Binary Translation
Binary Translation is a technique used in full virtualization where the hypervisor converts
unsafe guest OS instructions into safe instructions.
Binary Translation is a technique used in full virtualization where the hypervisor converts
privileged or sensitive instructions of the guest operating system into safe instructions. This is
required because guest OS cannot directly access real hardware in a virtual environment. The
hypervisor intercepts unsafe instructions, translates them, and executes them safely. This
helps to run unmodified guest OS inside a virtual machine.
Fig: Full Virtualization with Binary Translation
Why needed?
Because some OS instructions cannot run directly in VM mode.
• Guest OS runs normally
• Hypervisor ensures protection and control
• When a Guest OS (Windows/Linux inside VM) runs, it gives some special
commands like:
control hardware
change CPU mode
access memory directly
• But in a VM, guest OS is not allowed to directly control the hardware, because it
is not the real owner. Only hypervisor is allowed.
Advantage:
• No need to modify guest OS
Disadvantage:
• Additional overhead
DIFFERENCE BETWEEN FULL VIRTUALIZATION & PARA VIRTUALIZATION

Feature Full Virtualization Para Virtualization

Guest OS modification Not required Required

Performance Medium High

Technique used Binary Translation Hypercalls

Compatibility High Limited

Example VMware Xen

Difference between Trap and Execute & Binary Translation

Feature Trap-and-Execute Binary Translation

What it Catches privileged instruction and runs Rewrites unsafe instruction and
does safely runs

Main action Trap (stop) → execute Translate → execute

Instruction cannot be safely


Used when CPU can trap the instruction
trapped

Speed Can be slower due to many traps Can be slower due to translation

You might also like