Transforming: Physical
Transforming: Physical
Classic Data Center (CDC) into Virtualized Data Center (VDC) requires virtualizing the (application storage compute
*
Transforming a a core elements , , ,
network) ofthe data center
Using a phased approach => No need to do all of them (just what required) .
to a virtualized
infrastructure enables
smoother transition to
virtualize core elements.
Compute Virtualization Enable multiple : OS to run on the same machine at the same time given an instance to run each machine .
Chypervior) >
- resides between hardware & VMs .
> Creates illusion that there are multiple layers of the physical resources
(compute
,
Network ,
Storage) .
[1 hardware
Jargon (Synonym) : a
physical machine - host machine -
compute-Server
* Virtual machine -
guest machine -
Virtual compute - Virtual Server
>
- specifically designedI
tested for a specific type
of hardware
&
Save CAPEX
fightly
of
since we have multiple OS of different type running on the same type
hardware
-hardware there but NOT
running ↓
(CAPEX)
MAC Windows Linux
, , > runs on
- the same
Software
> Application must run on that type of OS which that must run on that type of hardware
=> No different software for each
which requires CPU that runs on some os which has binary machine code specifically
generated to this kind of processor .
Hypervisor :
software that allows multiple operating systems to run concurrently on a physical machine and interact directly with the physical hardware.
-Virtual Machine Monitor (VMM): Acts as a descriptor for the virtual machine.
Types :
-Bare-metal hypervisor: runs directly on the hardware of the physical machine (base metal)
- It allows for different types of VMs to run on it.
-Hosted hypervisor: runs as an application on top of the operating system.
- VMs can be created and managed through this host layer, often using VM software.
VM Scheduling: The hypervisor kernel handles the scheduling of VMs, allowing one VM to run for a certain time and then switching to another.
-The OS has the kernel —> do scheduling, access demand, do network functionality, and manage storage.
virtual machine monitor: keep the info about the VM, the type of OS it is using, how much memory is allocated to it, storage, etc.
—> The one that must know what the VM is doing is the hypervisor.
illusion
of hardware
1 -
Bare-Metal Hypervisor : VMware ESX EESXi ,
Oracle VM
-
Act as an OS >
if it crashes - others will still work because
they are working on isolation manner .
-
Installs & runs on x86 bare-metal hardware
process
a (process boot in here
<
-
Fast (short process process 1
process
- more efficient than hosted hypervisor
-more
performing
-
Found mostly in cloud data centre
2- Hosted
Hypervisor : VMware Workstation Eserver Oracle ,
VM VirtualBox -
3 Both Bare-Metal I Hosted :
process 2f
Relies physical Machine.
- on OS
running
on
processi & process
you
> used for debugging , Software development testing
,
-Slow
(long process)
D Install MAC hypervisor (parallel hypervisor) -> run MAC OS -> run
the MAC application within MAC OS VM .
2) Dual boot When the bias boots up (machine powers up) -> we
:
can boot in windows Cor another OS) - we can choose which one is default which one to configure .
have
, we OS installed -> it has all
physical storage ,
disk drives RAMs
, >
-
Storage can be overwritten to os -
> host hypervisor will run .
7- After doing all these checking and monitoring configurations, the BIOS will start, then it will run the OS.
8- It will try to find where the executable is.
The BIOS will find where the image for the OS is (image meaning executable because the OS is a code or application that is executable).
9- it loads that OS in the RAM memory, then starts transferring control to it and starts executing.
Flow: CPU → BIOS (do monitoring, check errors) → Finds OS to load (OS starts running).
ROM
BIOS
RAM —> You load the hypervisor —> it will run with its interface —> you
can load VMs.
BIOS boot an executable in RAM
Boot
loader appexerimage executable
& OS
There could be multiple OS os loader
L
running
. boots the
image
From app . exe
into
memory
we ad
>
-
& instruction
privilege
subset of privilege
3
instructions
OS is designed to run on a bare-metal hardware and to fully own the hardware: Not used
Pr
OS
>
hypervisor must run on top of hardware
HW it must have total control ofthe
Where can we place the hypervisor and OS? hypervisor must run on ring 0, but to place the OS we have 3 techniques. Vi
VirtualMachineMonitas a
VMM-HV
>
1234 ----- L 32 OS
JMP6784
The hypervisor must scan every code, every assembly instruction within the OS executable —> a lot of work and takes a lot of time.
- Why does Full Virtualization take a lot of time? Because it does a lot of binary translation —> We have to scan every instruction line by line, and
sometimes it misses.
Do we have to change the original executable of the OS? No, the changes are all made by the HV itself. The guest OS requires no modifications.
Nonvirtualized instructions (privilege) include sensitive kernel operations (CPU ops, memory management, interrupt handling and time keeping) —> If a
guest OS accesses CPU flags, the binary translation program replaces these with calls to the hypervisor or specific opcodes to trap into VMM.
Hello.c—>Hello.exe: when you compile Hello.c, you will get the executable Hello.exe which contains the assembly instructions.
-Para: alongside.
-Paravirtualization allows communication between the guest OS and hypervisor to improve performance.
-Guest OS knows that it is virtualized
-Modified guest OS kernel is used —> The source code of the guest OS is modified —> All system HW resource access related code is modified with
Hypervisor APIs.
-Unmodified guest OS is not supported —> Compatibility and portability are poor
-Paravirtualization must have special version of OS that runs on top of HV to not have a problem if you run both OS and HV at the same ring
—> The OS code is written for virtualization (in the previous one there was no modification—> the modification was only by HV).
—>All these privileged/non-virtualized instructions (called hyper calls —> calls to the hypervisor) are replaced by calls that will trap in HV code
—> here, every privileged instruction in this modified OS version already has calls to the HV.
Modified code of OS, where for every privileged code, it is written specifically to run on top of HV.
—> Instead of having a sys call, we have a hyper call.
76784
os executable
VMM-HV
V-RST S
32 OS
>
-
having special version of the OS that
1234 L HURAM
designed to top of HV .
----
is
-
run on
JMP6784
Process Switching:
If one PCB is running and we want to run the other one (one is in running and other is in ready state) —>
we copy the CPU register of the process running into the PCB, then load the CPU register from PCB into
CPU.
—> Rather than doing all this, when switching from one OS to another, it is done automatically by the
CPU (CPU does the copying) in Hardware Assisted Virtualization.
Xen Hypervisor: A bare-metal HV that employees paravirtualization —> free open source software for hypervisor.
domain
to interact hypervisor a User
with
>
-
it if you want
go through
to access the hardware
>
- Kernel :
Scheduling creation, ,
management
At the user level you must initiate the hyper call through Oracle VM Agent then can call the hypervisor
- ,
you
-
.
Dom 0 takes these hypercalls (from DomU1 and DomU2), then passes it to the kernel (hypervisor down).
It also provides console management (CLI) —> If you want to manage, run, start all in Dom 0.
Dom 0 gets all hypercalls from the virtual machine running at the user domain and provides console management (CLI, GUI).
Virtual Machine:
-From a User's Perspective: VM is a logical compute system.
Runs an OS and applications like a physical machine.
Contains virtual components such as CPU, RAM, disk, and NIC (all stored in an image "AMI").
—> Give me a machine with OS —>within that OS I run an app on top of it.
-From a Hypervisor’s Perspective: VM is a discrete set of files including Configuration, Virtual disk, Virtual BIOS, VM swap, and Log files.
Each file contains information about different aspects of the VM.
—> I am a hypervisor, I need to give information about the VM (how much storage, RAM, CPU it has, configuration of BIOS and hard disk).
—> All this information we keep in an image (AMI).
—> AMI has a package with all these files —> One of these files has all information about the VMs.
Virtual Machine Files:
• Log File:
Keeps a log of VM activity (events, errors) and is useful for troubleshooting.
Captures events, errors, and anything related to OS (like event viewer) —> Every event (including entering a password) is recorded.
Hypervisors support multi-core, hyper-threading, and CPU load- balancing features to optimize CPU resources.
- Multi-core processors: multiple processing units (cores) in a single CPU.
- Hyper-threading: physical CPU appear as two or more logical CPUs
1) Multi-core Processors: processors with different types of architecture (one processor with multiple cores)
-Socket (processor): CPUs that combine two or more cores into a single integrated circuit —> each socket has its own power
-Virtual machines can be configured with one or more virtual CPUs.
-Virtual CPUs in virtual machines run on a physical CPU by the hypervisor.
-Hypervisor scheduler: optimizes the placement of virtual CPUs onto different sockets/processors to maximize the overall utilization and performance.
VM that runs at multiple cores —> better performance—> By running the OS using timesharing.
give each app or process a time slot to run —> one process is given to a core, and then another process to another core —> At any instance of
time, we can have multiple apps/processes running at the same time.
expensive
↓
each CPU has its
own ALU , Cache ,
registers
d
but all packaged
in one socket (processor(
1 2
2) Hyper-threading: Makes a physical CPU appear as two Logical CPUs (LCPUs) —> Enables OS to schedule two or more threads simultaneously.
- Two LCPUs share the same physical resources —> While the current thread is stalled, CPU can execute another thread (Due to cache miss or data
dependency).
- Hypervisor running on a hyper-threading-enabled CPU provides improved performance and utilization.
- Every CPU has its own core/ALU —> If you want to do load balancing → increase performance by increasing the number of cores.
X- delete this to - The process of saving and restoring registers manually is expensive in terms of time and resources.
Terminatea Save
energy
When a hypervisor is running on multi-processor and hyper-threading-enabled compute systems —> need to balance the load across CPUs to achieve
performance —> do it by migrating a thread from one logical CPU (over utilized) to another (under utilized) to keep the load balanced.
1 2 3
VM2 is communicating with VM3, VM1 is not communicating with any. How will you access the hypervisor
- Power/Energy Saving: Hypervisor shuts down unused cores (core connected with VM1) to save power by
holding their state —> ex: matrix multiplication
- Load Balancing: Hypervisor distributes tasks across logical cores dynamically to prevent overloading and
improve performance.
logical CPU
↑
each 2 translated to
one
physicalpu
VM Affinity: link a VM to certain hardware / hypervisor —> each hardware has different characteristics (licenses) —> assign the VM to the hardware /
hypervisor with the specific characteristics they need to be launched on.
- When sharing hardware —> performance is reduced.
- Affinity can be assigned freely unless if you have a VM that requires a special hardware —> it must be assigned to a special hardware.
Types:
2- VM to VM Affinity: A selected group of VMs is affinitized to the same hypervisor to improve performance when VMs are communicating with each other
heavily and for licensing reasons.
- If a group of VMs communicate heavily —> they are placed under the same hypervisor or close hypervisors to avoid delays.
3- Anti-Affinity: Ensures selected VMs are not together on a hypervisor for availability, green computing, or load balancing.
- allows VMs to migrate to different hypervisors in a cluster.
- used when there is no communication between VMs and when the exact location of a VM does not matter.
- helps with load balancing or consolidating VMs, especially in cloud datacenters.
- If a VM’s hardware is going crazy, we can’t affinitize it under the same hypervisor since that hardware acts strangely —> Anti-affinity allows us to
monitor, move the VM, and reassign it elsewhere.
When there is no heavy communication, and we want to save power and consolidate resources, balance the load, or ensure availability.
If two VMs share the same hardware under the same hypervisor, they also share RAM, disk, and internal cache, making them vulnerable to attacks.
—> Anti-affinity avoids this by separating the VMs, ensuring they don’t share resources and reducing the risk of security breaches.
- Hypervisor must manage the memory by assigning it to cores and CPUs.
- If you have a physical RAM of 4 GB, when you run a VM it requires 2 GB —> you ca n run 1 VM not 2 because the hypervisor has to run, so it will
occupy part of the RAM before we bring the OS of VM.
- Hypervisor has limited ability of the physical RAM → we make the physical RAM that is available for the VM not processes look more than what is really
allocated physically.
—> Hypervisor must do memory optimization and memory commitment using 3 techniques:
-data
B A Virtual Memory
Linux Windows
physical RAM
2 1
separat copysincehaea
requirements.
2- Memory Ballooning:
- A way to manage memory by letting the hypervisor take memory from one VM and give it to another.
- Hypervisor uses a balloon driver (BD) installed in the Guest OS of the VM with lower priority to reclaim memory.
- Hypervisor reallocates the reclaimed memory to a high-priority VM that needs more resources.