CC - Module 2 Notes
CC - Module 2 Notes
Module – 2
Department of ISE
Vision
Building Information Technology Professionals by Imparting Quality Education and Inculcating
Key Competencies
Mission
Provide strong fundamentals through learner centric approach
Instil technical, interpersonal, interdisciplinary skills and logical thinking for holistic
development
Train to excel in higher education, research, and innovation with global perspective
Develop leadership and entrepreneurship qualities with societal responsibilities
Syllabus
Virtual Machines and Virtualization of Clusters and Data Centers:
Implementation Levels of Virtualization, Virtualization Structure/Tools and Mechanisms,
Virtualization of CPU/Memory and I/O devices, Virtual Clusters and Resource Management,
Virtualization for Data Center Automation.
Textbook 1: Chapter 3: 3.1 to 3.5
Module – 02
Virtualization allows multiple virtual machines (VMs) to run on the same physical hardware,
improving resource sharing, performance, and flexibility.
o Virtualizes the instruction set of the host machine to emulate different processor
architectures (e.g., running MIPS code on an x86 machine). o Uses code interpretation or
dynamic binary translation for better performance.
o Virtualizes hardware resources like CPU, memory, and I/O devices to allow multiple users to
utilize the hardware concurrently.
o Historical example: IBM VM/370, modern example: Xen hypervisor for x86 machines.
o Virtualizes the communication link between applications and the OS through API hooks.
o Examples include WINE (Windows applications on UNIX) and vCUDA (GPU acceleration
within VMs).
User-Application Level:
Performance Considerations:
• VMM (Virtual Machine Monitor) is a layer between hardware and the operating system.
• Manages hardware resources and captures program interactions with hardware.
• Enables multiple OS instances to run on a single set of hardware.
Requirements of a VMM:
Performance Considerations:
Timing dependencies and resource availability may cause minor performance differences.
Traditional emulators/simulators offer flexibility but are too slow for real-world use.
Cloud computing relies on virtualization to shift hardware and management costs to third-party
providers.
1. Same OS requirement – All VMs on a single container must belong to the same OS family
(e.g., Windows-based VMs cannot run on a Linux host).
2. User preference issues – Some cloud users require different OS types, limiting flexibility.
3. Resource duplication problem – If each VM has a full copy of system resources, it leads to
high storage and performance costs.
2. Share most resources and create private copies on demand (preferred approach).
OS-level virtualization is often a second choice due to its limitations compared to hardware-
assisted virtualization.
Virtualization on Linux and Windows Platforms
1. Virtual environments (VPS) – Each VPS functions like an independent Linux server with its
own processes, users, and virtual devices.
2. Resource management – Controls CPU, disk space, and memory allocation.
3. Check pointing and live migration – Saves VM state to a file for quick transfer and
restoration on another machine.
Resource Management in OpenVZ:
Library-level virtualization is also known as user-level Application Binary Interface (ABI) or API
emulation.
This type of virtualization can create execution environments for running alien programs on a
platform rather than creating a VM to run the entire operating system.
API call interception and remapping are the key functions performed. This section provides an
overview of several library-level virtualization systems.
Namely the Windows Application Binary Interface (WABI), lxrun, WINE, Visual MainWin, and
vCUDA, which are summarized in Table 3.4.
Virtualization Structure/Tools and Mechanisms
VM Architecture Classes
After virtualization, a virtualization layer is inserted between the hardware and OS, converting
real hardware into virtual hardware.
This allows multiple OSes (Linux, Windows, etc.) to run simultaneously on a single machine.
There are three main classes of VM architecture:
Types of Hypervisors:
Domain 0 (Dom0):
Domain U (DomU):
o Unprivileged guest OS instances running under Xen.
Security Considerations
• Domain 0 is the most critical component. If compromised, the attacker gains full control
over all VMs.
• Security policies are required to protect Domain 0.
VM State Management and Rollback
Unlike traditional machines (which follow a linear execution path), VM execution follows a tree
structure where multiple instances can be created at different states.
Challenges:
Full virtualization does not need to modify the host OS. It relies on binary translation to trap
and to virtualize the execution of certain sensitive, nonvirtualizable instructions.
The guest OSes and their applications consist of noncritical and critical instructions. In a host-
based system, both a host OS and a guest OS are used.
A virtualization software layer is built between the host OS and guest OS. These two classes of
VM architecture are introduced next.
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. Why are only
critical instructions trapped into the VMM? This is because binary translation can incur a large
performance overhead.
Noncritical instructions do not control hardware or threaten the security of the system, but
critical instructions do.
Therefore, running noncritical instructions on hardware not only can promote efficiency, but
also can ensure system security.
Host-Based Virtualization
The virtualization layer sits between the host OS and guest OS.
• Guest OSes and applications can run inside VMs, while other applications can run
directly on the host OS.
Advantages:
o Easier deployment (no need to modify the host OS).
o Simplified design (relies on the host OS for device drivers).
o Works on various hardware configurations.
Disadvantages:
o Lower performance due to multiple layers of hardware access.
o Requires binary translation if guest OS and host hardware have different ISAs.
o High overhead, making it less efficient in practice.
Para-Virtualization with Compiler Support
Overview of Para-Virtualization
• Requires modification of the guest OS kernel to support virtualization.
• Provides special APIs (hypercalls) to replace non-virtualizable OS instructions.
Para-Virtualization Architecture
A virtualization layer is inserted between hardware and OS.
In the x86 architecture, the OS typically runs at Ring 0 for privileged operations, while
applications run at Ring 3.
Advantages of Para-Virtualization
Challenges of Para-Virtualization
• Requires modifying the OS kernel, making it less compatible with unmodified OSes.
• Maintaining para-virtualized OS versions is costly, as OS updates require modifications.
• Performance benefits depend on workload types—some workloads benefit greatly,
while others do not.
This is a Linux para-virtualization system—a part of the Linux version 2.6.20 kernel. Memory
management and scheduling activities are carried out by the existing Linux kernel.
The KVM does the rest, which makes it simpler than the hypervisor that controls the entire
machine.
Modern processors (e.g., x86) use hardware-assisted virtualization to support virtual machines
efficiently.
The Virtual Machine Monitor (VMM) and guest OS operate in separate modes, ensuring security
and isolation.
Sensitive instructions of the guest OS are trapped in the VMM, preventing unauthorized
hardware access.
o Supervisor Mode (Privileged Mode): Runs the OS kernel and handles critical system
operations.
CPU Virtualization
VMs execute most instructions in native mode for efficiency, except critical instructions.
CPU virtualization requires trapping privileged instructions so that the VMM can handle them
securely.
RISC architectures are naturally virtualizable, as all sensitive instructions are privileged.
x86 architecture is not naturally virtualizable because some sensitive instructions (e.g., SGDT,
SMSW) are not privileged and cannot be trapped by the VMM.
• In UNIX systems, system calls trigger the 0x80 interrupt, passing control to the kernel.
• In Xen (a para-virtualization system), system calls trigger both 0x80 (guest OS) and 0x82
(hypervisor).
• The hypervisor processes privileged operations before returning control to the guest OS.
Intel and AMD introduced an additional privilege mode (Ring -1) for virtualization.
Now, the hypervisor runs at Ring -1, while the guest OS runs at Ring 0.
This eliminates the need for complex binary translation (used in full virtualization).
Benefits:
o The OS maps virtual memory to machine memory using page tables (one-stage mapping).
o Modern x86 CPUs use an MMU (Memory Management Unit) and TLB (Translation Lookaside
Buffer) to optimize memory performance.
Memory Virtualization in Virtualized Environments
o Physical RAM is shared and dynamically allocated among Virtual Machines (VMs).
o A two-stage mapping is required:
Guest OS: Maps virtual memory to guest physical memory.
VMM (Hypervisor): Maps guest physical memory to actual machine memory.
o Each guest OS page table has a corresponding shadow page table maintained by the VMM.
o This additional layer leads to performance overhead and high memory costs.
o Nested Paging (Hardware-Assisted Virtualization):
Reduces the overhead of shadow page tables.
Introduced by AMD’s Barcelona processor (2007).
I/O virtualization manages routing of I/O requests between virtual devices and shared physical
hardware. There are three main approaches:
o The guest OS interacts with virtual devices, and the VMM handles I/O operations.
o Drawback: High overhead and lower performance compared to real hardware. Para-
Backend driver: Runs in the privileged domain (Domain 0) and manages real
I/O devices.
o Pros: Better performance than full emulation.
o Cons: Higher CPU overhead. Direct I/O Virtualization
Intel VT-d helps remap I/O DMA transfers and device interrupts, allowing direct device access
for VMs.
Self-Virtualized I/O (SV-IO) uses multi-core processors to virtualize I/O devices, providing an
efficient API for virtualized systems.
Multi-Core Virtualization
Virtualizing multi-core processors is more complex than uni-core processors due to:
Parallelization Challenges:
o Scheduling algorithms and resource management policies must optimize performance while
handling core assignments.
Dynamic Heterogeneity
• New architectures mix fat CPU cores and thin GPU cores on the same chip.
• Hardware reliability issues and increased complexity in transistor management make
resource allocation more difficult. Physical vs. Virtual Processor Cores Virtual CPU
(VCPU) Migration:
Wells et al. proposed a method where VCPUs can move between cores dynamically.
Reduces inefficiencies in managing processor cores by software.
Located below the ISA, making it transparent to OS and hypervisors.
Virtual Hierarchy
• Many-core chip multiprocessors (CMPs) enable space-sharing, where different jobs are
assigned to separate groups of cores for long intervals.
• Virtual hierarchy is a dynamic cache hierarchy that adapts to workload demands, unlike
static physical cache hierarchies.
• Proposed by Marty and Hill, this method optimizes performance isolation and cache
coherence.
How Virtual Hierarchy Works
Many-core CMPs typically use physical cache hierarchies (L1, L2) with static allocation.
Workloads are grouped into virtual clusters of cores, each assigned to different virtual machines
(VMs):
o Each VM operates in isolation, minimizing cache misses and ensuring efficient resource
allocation.
Two-Level Virtual Coherence & Caching Hierarchy
First level:
Second level:
o Maintains a globally shared memory for all VMs.
Migration of VMs
o Ensures load balancing, fault tolerance, and resource optimization. Memory and File
Migrations
Traditional VM Setup:
o Elastic Computing: Allows users to dynamically create, manage, and scale VMs.
o Platforms like XenServer and VMware ESX Server support bridging mode.
o VMs can freely communicate over the virtual network interface and self-configure.
Physical Clusters: Comprise multiple physical servers interconnected via physical networks.
Virtual Clusters: Comprise VMs distributed across multiple physical servers and connected
through a virtual network.
Properties of Virtual Clusters Flexible
Node Configuration
o Each VM runs a guest OS, which may differ from the host OS of the physical machine.
o VMs can be replicated across multiple servers for better fault tolerance and disaster
recovery.
o If a physical node fails, only the VMs running on that node are affected.
o A VM failure does not impact the host system. Scalability & Dynamic Allocation
o The number of nodes in a virtual cluster can increase or decrease dynamically, similar to
P2P networks.
Efficient VM Deployment & Monitoring: Requires techniques like resource scheduling, load
balancing, server consolidation, and fault tolerance.
VM Image Storage:
o They can span multiple physical clusters and adapt to changing workloads.
• Fast deployment involves quickly setting up OS, libraries, and applications on physical
nodes.
• VM runtime environments should switch efficiently between different users to optimize
resources.
• Green computing aims to minimize energy consumption across the cluster, not just on
single nodes.
• Live VM migration shifts workloads between nodes but can introduce overhead affecting
performance.
• Load balancing improves resource utilization and system response times.
High-Performance Virtual Storage
• VMs use template images (pre-installed OS and software) to reduce setup time.
• Copy-on-Write (COW) technique minimizes disk space usage by creating small, efficient
backup files.
• Storage management should reduce duplicate blocks to optimize disk usage in virtual
clusters.
Overview of VM Migration
• In mixed host-guest clusters, physical nodes run tasks directly, while VMs serve as failover
replacements.
• VM failover is more flexible than traditional physical failover but depends on the host’s
availability.
• Live VM migration enables a running VM to move between hosts without service
interruption.
Steps of Live VM Migration
Minimal Migration Overhead: Critical for dynamic cluster reconfiguration and disaster recovery,
especially in cloud computing.
1. Guest-Based Manager: Runs within VMs (e.g., openMosix on Xen, Solaris cluster on
VMware).
2. Host-Based Manager: Runs on physical hosts and can restart VMs after failure (e.g.,
VMware HA).
3. Independent Cluster Manager: Manages both host and guest systems, increasing
complexity.
4. Integrated Cluster Management: Differentiates between virtual and physical resources
for optimal efficiency.
Introduction
Due to the high initial cost of clusters—including space, power, and cooling—leasing or sharing
clusters is a cost-effective approach.
Shared clusters improve resource utilization through multiplexing and economies of scale.
Early configuration and management systems help define service-specific clusters and allocate
physical nodes accordingly.
When migrating a system to another physical node, several key considerations must be
addressed.
Memory Migration
Memory migration is a critical aspect of VM migration, as moving a VM’s memory from one
host to another must be done efficiently.
Memory transfer sizes typically range from hundreds of megabytes to several gigabytes.
Internet Suspend-Resume (ISR) Technique
The ISR technique exploits temporal locality, meaning that memory states in the suspended and
resumed VM instances are largely similar.
Mechanism:
o Both the suspended and resumed VM instances contain a copy of this tree.
Limitations:
• ISR uses a distributed file system as a transport mechanism for VM state transfer.
• The actual file systems are not mapped directly onto the distributed system.
• Instead, relevant files are copied into and out of the local file system during suspend and
resume operations.
• Advantages:
o Simplifies implementation by avoiding direct dependency on distributed file
system semantics.
• Challenges:
o The VMM must store VM virtual disk contents locally, which must be moved with
the VM state.
• Each VM is assigned a virtual IP address and MAC address, which are distinct from the
host machine’s address.
• The Virtual Machine Monitor (VMM) maintains a mapping between the virtual IP/MAC
o When a VM migrates to a new host, the migration must include all protocol states and
the IP address of the VM.
o On a switched LAN network, the migrating host sends an unsolicited ARP reply, informing
other devices that the VM’s IP has moved. This allows peers to update their network
configurations to route future packets to the VM’s new location.
o If the VM maintains its original Ethernet MAC address, the network switch can
automatically detect the migration to a new port without requiring further network
configuration.
Live migration refers to the process of moving a VM from one physical node to another without
interrupting the VM’s operating system or applications.
This is essential for various enterprise workloads such as load balancing, system maintenance,
and proactive fault tolerance.
Performance Degradation:
o The migration daemon consumes network bandwidth to transfer dirty pages, leading to
performance degradation.
o Rate limiting can mitigate performance hits, but this prolongs the migration process.
Convergence Issues:
o Some applications may not have small writable working sets, causing difficulties in
convergence, which might require additional migration iterations.
o The large volume of data transferred during the migration process is a key limitation in
precopy-based migration.
• CR/TR-Motion transfers an execution trace file rather than the dirty memory pages,
significantly reducing the amount of transferred data.
• Advantages:
o Drastically reduces total migration time and downtime.
o Log files (execution traces) are much smaller than dirty pages, leading to a more
efficient migration.
• Limitations:
o The approach is effective only if the log replay rate exceeds the log growth rate.
The differences between the source and target nodes may limit its effectiveness
in some scenarios.
Postcopy Migration
Postcopy migration transfers all memory pages at once, reducing the baseline migration time.
However, it introduces significant downtime due to latency as memory pages are fetched from
the source node before the VM can be resumed on the target node.
Advantages:
o Reduced total migration time as the baseline transfer is done only once.
Challenges:
Higher downtime compared to precopy due to the latency in fetching pages.
Compression Algorithms:
Xen is a widely used Virtual Machine Monitor (VMM) that supports live migration by utilizing a
send/recv model to transfer VM states between source and target hosts.
• Dom0 (the control domain) manages the migration process, including the creation,
termination, or migration of VMs across hosts.
Virtual Cluster Research and Dynamic Deployment
Several virtual cluster research projects have focused on dynamic deployment to improve the
flexibility and resource allocation of VMs across clusters:
These projects demonstrate the potential benefits of dynamic VM migration within virtual
clusters, ensuring resources are efficiently allocated based on demand
Automation enables dynamic resource allocation for millions of users with QoS and cost-
efficiency.
o 2006: $1.044 billion market share, dominated by production consolidation and software
development.
o 2011 (projected): $3.2 billion market share, expanding into high availability (HA), utility
computing, and workload balancing.
Developments in Virtualization
Key factors:
Scheduling levels:
Chatty workloads: Burst at peak times and remain idle otherwise (e.g., web video services).
Noninteractive workloads: Do not require human intervention after submission (e.g., high-
performance computing).
Challenge: Workloads have different resource demands, leading to underutilized servers when
resources are allocated for peak demand.
o Hardware resources
o Space and power
o Management costs
Resource optimization is needed at the level of CPU, memory, and network interfaces.
Key approach: Reduces the number of physical servers while optimizing resource use.
More effective than other consolidation techniques (e.g., centralized and physical consolidation).
o VM level
o Server level
o Local controller (VM level) and Global controller (server level) work together
for autonomic resource allocation.
Traditional Storage Virtualization: Aggregation and repartitioning of physical disks for use by
physical machines.
o VMs provide isolation between guest OSes, allowing multiple VMs to run on a
physical machine.
o Storage systems struggle to keep up with system and CPU advancements, becoming
the bottleneck in VM deployment.
o Guest OS storage operations behave as though accessing a real hard disk, but they
cannot directly access the physical disk.
o Multiple guest OSes may compete for disk resources when running on the same
machine.
o The storage management layer of the underlying VMM is much more complex than
traditional guest OS management.
VM Storage Primitives:
o Operations like remapping volumes across hosts and checkpointing disks are
complicated and sometimes unavailable.
Flooded VM images: Large numbers of VMs in data centers create excessive VM images,
consuming significant storage space.
storage VMs that share physical hosts with the VMs they serve, improving
o Acts as a block virtualization layer between the VMs and physical storage devices. o
Provides a virtual disk for each VM on the same physical machine.
o Supports various system virtualization techniques, such as paravirtualization and full
virtualization.
Benefits of Parallax
Several Virtual Infrastructure (VI) managers and Cloud OSes are designed for managing
virtualized data centers efficiently.
Functions of VI Managers:
The VMM (Hypervisor) creates and manages VMs, acting as an interface between OS and
hardware.
A VM is fully encapsulated, meaning its entire state can be copied, moved, and deleted like a
file.
The VMM is the foundation of security in a virtual system, controlling how VMs access
hardware resources.
Typically, one management VM is privileged to create, suspend, resume, or delete other VMs.
o If an attacker gains control over the VMM or management VM, all VMs and the entire
system are at risk.
o VMs can be rolled back to a previous state, causing old random numbers to be reused.
o This weakens session key security in cryptographic protocols. o TCP hijacking attacks
can occur due to reuse of initial sequence numbers.
Intrusion Detection System (IDS): Detects and recognizes these unauthorized actions.
VMM Security Monitoring: The VMM can monitor and audit access requests for hardware and
system software.
IDS Logs:
o Logs are used for security monitoring but must be protected from tampering.