Questions: 1. What is a Virtual Machine? Why VMs became popular ? 2. Explain the components of virtualization. 3. Explain how the VMM provides isolation between multiple virtual machines. 4. What is a Hypervisor or VMM ? 5. State any two advantages of virtual machines. 6. What is virtualization overhead? Explain how CPU‒bound, I/O‒bound and I/O‒intensive programs behave under virtualization. 7. Discuss the requirements of a Virtual Machine Monitor (VMM). 8. Describe the hardware and ISA requirements necessary to support efficient virtualization. 9. Explain the protection issues related to instruction set architectures in virtual machines.
Introduction
to Virtual Machines
•
Virtual Machines are an important technology that allow one physical computer
to run multiple operating systems at the same time. Although the idea of
virtual machines started in the 1960s, they have become extremely popular in
recent years due to the need for better isolation, security and resource
sharing in modern computing systems.
•
A Virtual Machine (VM) is a software‒based
environment that behaves like a complete computer system. It includes its own
virtual CPU, memory, storage and operating system.
•
A single physical computer (called the
host) can run multiple VMs at the same time. Each VM runs its own operating
system and applications as if it were a separate machine.
Examples
of system‒level VMs :
■
IBM VM/370
■
VMware ESX Server
■
Xen
■
VirtualBox
•
Virtual machines gained importance due to several reasons:
1. Improved isolation
and security: Each VM is separated from others, so one
VM cannot easily affect another.
2. Problems with
traditional operating systems: Modern OSes sometimes
have security and reliability issues; VMs provide an extra protection layer.
3. Resource Sharing
(Cloud computing) : In environments like Amazon Web Services
(AWS) EC2, VMs enable the efficient sharing of a single server among many
customers, maximizing hardware utilization.
4. Faster processors :
Modern processors are very powerful, so the additional overhead of running VMs
is acceptable.
•
Virtual machine technology relies on specific software and hardware
interactions :
■ Host:
Physical hardware platform (the real computer).
■ Guest:
The Virtual Machine, including its operating system and applications, running
on the host hardware.
■ The VMM (or
Hypervisor) is the core piece of software that manages the
VMs. It is much smaller than a traditional OS (sometimes only around 10,000
lines of code) and has three primary responsibilities:
♦ Interface
presentation : Presents the illusion of a complete
system to each guest OS.
♦ Resource mapping :
Determines how virtual resources (like virtual CPU time, virtual disk space,
virtual network) are mapped to the physical resources of the host. Resources
can be time‒shared, partitioned or
emulated in software.
♦ Isolation and
protection : It must isolate the state of each guest from all
others and protect itself from any malicious or faulty guest software.
■
VMs allow running old operating systems (e.g., DOS) alongside new ones.
■
Developers use VMs to test new software without affecting their main system.
■
VMs allow multiple applications and OS versions to run on the same machine.
■
Some hypervisors can migrate a
running VM to another physical computer without stopping it useful for load
balancing and maintenance.
Example: Virtual Machines
in Cloud Computing (AWS EC2)
•
Amazon Web Services (AWS) uses VMs heavily in its EC2 cloud service. VMs help
AWS to:
1. Isolate users from
each other
2. Easily distribute
software images
3. Stop or
"kill" VMs to control resource usage
4. Hide the underlying
hardware so old and new servers can coexist.
5.
Offer different price categories of machines on the same hardware.
•
The performance cost of virtualization depends on the type of program:
■
Use mostly the processor and make few system calls.
■
The VMM rarely needs to intervene.
■
Almost zero overhead → runs at near
native speed.
■
Perform many system calls (disk, network, devices).
■
The VMM must check or emulate many privileged instructions.
■
High overhead.
■
Spend most time waiting for slow I/O devices.
■
Processor is often idle, so virtualization cost is hidden.
■
The virtualization overhead depends on :
1.
How many instructions the VMM must emulate.
2.
How long each emulation takes.
•
To reduce this overhead, if the virtual machine uses the same instruction set as the real hardware, the VMM tries to let
most instructions run directly on the
actual processor instead of emulating them. This makes the VM much faster.
•
A Virtual Machine Monitor (VMM) has
the responsibility of creating and managing virtual machines. It must:
1. Provide a software
interface that looks like real hardware to the guest
operating systems and applications.
2.
Keep each guest VM isolated, so that
the actions of one VM do not affect another.
3.
Protect itself from any incorrect or
harmful behavior of the guest software.
•
The qualitative requirements are:
■
The guest software should behave as if
it is running on real hardware, except for minor differences due to
performance or sharing of limited resources.
■
The guest OS must not be able to
directly change the actual hardware resources of the system.
•
To fully virtualize the processor, the VMM must control almost all important
activities, such as:
■
Access to privileged processor state
■
Input/Output (I/O) operations
■ Exceptions and
interrupts
Even
though the guest OS is running, the VMM remains in control.
Example :
When a timer interrupt occurs :
1.
The VMM stops the currently running VM.
2.
It saves the VM's state.
3.
It handles the interrupt.
4.
It selects which VM should run next.
5.
It restores that VM's state.
•
Each guest VM is given a virtual timer
and an emulated timer interrupt,
provided by the VMM.
•
The VMM must always be at a higher
privilege level than the guest OS. The guest OS generally runs in user mode, ensuring that any attempt to
run privileged instructions will cause a trap
to the VMM.
•
For effective virtualization, the hardware must provide :
1. At least two modes
of operation
■
System (kernel) mode
■
User mode
2.
A set of privileged instructions
that can be executed only in system mode. If these instructions are executed in
user mode, they must generate a trap,
allowing the VMM to take control.
•
Virtual machines work best when the Instruction
Set Architecture (ISA) is designed with virtualization in mind. If the ISA
supports virtualization, fewer instructions need to be emulated by the Virtual
Machine Monitor (VMM) and the virtual machine can run almost directly on the
hardware. Such an ISA is called virtualizable.
Examples include IBM 370 and RISC‒V.
•
Many popular ISAs such as x86, ARMv7 and
MIPS were originally designed without considering virtualization. These
architectures contain some instructions that :
■
access sensitive hardware state
■
behave differently depending on the privilege level
■
do not trap when executed in user mode
•
This creates problems for virtualization.
•
A guest operating system must run in user
mode so that it cannot directly access real hardware. When the guest OS
executes a privileged instruction
(like enabling or disabling interrupts), it should generate a trap, allowing the VMM to:
1.
intercept the instruction
2.
update or simulate the virtual hardware state
3.
return control to the guest OS
•
This ensures that the guest OS interacts only with virtual resources, not real ones.
•
If the ISA does not automatically trap
on sensitive instructions executed in user mode :
■
The VMM must find and handle all such instructions manually.
■
It must rewrite, emulate, or modify them before execution.
■
This makes the VMM more complex, and
■
It reduces VM performance, because
more instructions need software emulation.
•
Protection in a computer system is handled by both the hardware and the
operating system. When virtual memory became common, some old instruction sets
needed changes because certain instructions did not work correctly in virtual
machines.
•
Example : In x86, the instruction POPF updates the processor flags. In
user mode, it Mupdates all flags except the Interrupt Enable (IE) flag, and it
does not cause a trap. But a guest OS running inside a VM expects IE to change,
so this causes incorrect behavior.
•
To make virtual machines efficient, IBM mainframes historically used three
techniques:
1.
Lower the cost of processor virtualization.
2.
Reduce interrupt overhead.
3.
Deliver interrupts directly to the correct VM without involving the VMM.
1. What is a Virtual
Machine? Why VMs became popular ?
2. Explain the
components of virtualization.
3. Explain how the VMM
provides isolation between multiple virtual machines.
4. What is a
Hypervisor or VMM ?
5. State any two
advantages of virtual machines.
6. What is
virtualization overhead? Explain how CPU‒bound, I/O‒bound and I/O‒intensive
programs behave under virtualization.
7. Discuss the
requirements of a Virtual Machine Monitor (VMM).
8. Describe the
hardware and ISA requirements necessary to support efficient virtualization.
9. Explain the
protection issues related to instruction set architectures in virtual machines
Computer Organization and Architecture: Chapter 4: Memory and IO : Tag: Computer : - Introduction to Virtual Machines
Computer Organization and Architecture
CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Discrete Mathematics
MA25C14 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation
Data Structures
CS25C08 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation
Computer Organization and Architecture
CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Object Oriented Programming
CS25C07 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
Web Technologies
IT25301 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation
English Communication Skills Laboratory I
EN25C03 3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation
Skill Development Course I
3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation