0% found this document useful (0 votes)
10 views20 pages

U5 - Virtual Machines

The document provides an overview of virtual machines (VMs), detailing their architecture, types, and benefits. It explains the roles of the host, hypervisor, and guest in virtualization, as well as the various hypervisor types including Type 0, Type 1, Type 2, and paravirtualization. Additionally, it discusses the advantages of VMs such as resource efficiency, security, and the ability to run multiple operating systems on a single physical machine.

Uploaded by

celey22909
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)
10 views20 pages

U5 - Virtual Machines

The document provides an overview of virtual machines (VMs), detailing their architecture, types, and benefits. It explains the roles of the host, hypervisor, and guest in virtualization, as well as the various hypervisor types including Type 0, Type 1, Type 2, and paravirtualization. Additionally, it discusses the advantages of VMs such as resource efficiency, security, and the ability to run multiple operating systems on a single physical machine.

Uploaded by

celey22909
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
You are on page 1/ 20

VIRTUAL MACHINES

CONTENTS

• Overview
• Benefits and Features
• Building Blocks
• Types of Virtual Machines and Their Implementations
OVERVIEW

• Fundamental idea – abstract hardware of a single computer into several different execution
environments
• Similar to layered approach
• But layer creates virtual system (virtual machine, or VM) on which operation systems
or applications can run
• Several components
• Host – underlying hardware system
• Virtual machine manager (VMM) or hypervisor – creates and runs virtual machines
by providing interface that is identical to the host
• (Except in the case of paravirtualization)
• Guest – process provided with virtual copy of the host
• Usually an operating system
• Single physical machine can run multiple operating systems concurrently, each in its own
virtual machine
OV E RV I E W

Non-virtual machine Virtual machine


OV E RV I E W

• Vary greatly, with options including:


• Type 0 hypervisors - Hardware-based solutions that provide support for virtual machine creation and
management via firmware
• IBM LPARs and Oracle LDOMs are examples
• Type 1 hypervisors - Operating-system-like software built to provide virtualization
• Including VMware ESX, Joyent SmartOS, and Citrix XenServer
• Type 1 hypervisors – Also includes general-purpose operating systems that provide standard functions
as well as VMM functions
• Including Microsoft Windows Server with HyperV and RedHat Linux with KVM
• Type 2 hypervisors - Applications that run on standard operating systems but provide VMM features to
guest operating systems
• Including VMware Workstation and Fusion, Parallels Desktop, and Oracle VirtualBox
IMPLEMENTATION OF VMMS (CONT.)

• Other variations include:


• Paravirtualization - Technique in which the guest operating system is modified to work in
cooperation with the VMM to optimize performance
• Programming-environment virtualization - VMMs do not virtualize real hardware but
instead create an optimized virtual system
• Used by Oracle Java and Microsoft.Net
• Emulators – Allow applications written for one hardware environment to run on a very
different hardware environment, such as a different type of CPU
• Application containment - Not virtualization at all but rather provides virtualization-like
features by segregating applications from the operating system, making them more secure,
manageable
• Including Oracle Solaris Zones, BSD Jails, and IBM AIX WPARs
• Much variation due to breadth, depth and importance of virtualization in modern
computing.
BENEFITS AND FEATURES

• Host system protected from VMs, VMs protected from each other
• i.e. A virus less likely to spread
• Sharing is provided though via shared file system volume, network communication
• Freeze, suspend, running VM
• Then can move or copy somewhere else and resume
• Snapshot of a given state, able to restore back to that state
• Some VMMs allow multiple snapshots per VM
• Clone by creating copy and running both original and copy
• Great for OS research, better system development efficiency
• Run multiple, different OSes on a single machine
• Consolidation, app dev, …
BENEFITS AND FEATURES (CONT.)

• Templating – create an OS + application VM, provide it to customers, use it to


create multiple instances of that combination
• Live migration – move a running VM from one host to another!
• No interruption of user access
• All those features taken together -> cloud computing
• Using APIs, programs tell cloud infrastructure (servers, networking, storage) to
create new guests,VMs, virtual desktops.
BUILDING BLOCKS

• Generally difficult to provide an exact duplicate of underlying machine


• Especially if only dual-mode operation available on CPU
• But getting easier over time as CPU features and support for VMM improves
• Most VMMs implement virtual CPU (VCPU) to represent state of CPU per guest as guest
believes it to be
• When guest context switched onto CPU by VMM, information from VCPU loaded and stored
• Several techniques, as described in next slides
BUILDING BLOCK – TRAP AND EMULATE

• Dual mode CPU means guest executes in user mode


• Kernel runs in kernel mode
• Not safe to let guest kernel run in kernel mode too
• So VM needs two modes – virtual user mode and virtual kernel mode
• Both of which run in real user mode
• Actions in guest that usually cause switch to kernel mode must cause switch to virtual kernel mode
TRAP-AND-EMULATE (CONT.)

• How does switch from virtual user mode to virtual kernel mode occur?
• Attempting a privileged instruction in user mode causes an error -> trap
• VMM gains control, analyzes error, executes operation as attempted by guest
• Returns control to guest in user mode
• Known as trap-and-emulate
• Most virtualization products use this at least in part
• User mode code in guest runs at same speed as if not a guest
• But kernel mode privilege mode code runs slower due to trap-and-emulate
• Especially a problem when multiple guests running, each needing trap-and-emulate
• CPUs adding hardware support, mode CPU modes to improve virtualization
performance.
TRAP-AND-EMULATE VIRTUALIZATION IMPLEMENTATION
TYPES OF VIRTUAL MACHINES AND IMPLEMENTATIONS

• Many variations as well as h/w details


• Assume VMMs take advantage of h/w features
• h/w features can simplify implementation, improve performance
• Whatever the type, a VM has a lifecycle
• Created by VMM
• Resources assigned to it (number of cores, amount of memory, networking details,
storage details)
• In type 0 hypervisor, resources usually dedicated
• Other types dedicate or share resources, or a mix
• When no longer needed,VM can be deleted, freeing resources
• Steps simpler, faster than with a physical machine install
• Can lead to virtual machine sprawl with lots of VMs, history and state difficult to
track
TYPES OF VMS – TYPE 0 HYPERVISOR

• Old idea, under many names by h/w manufacturers


• “partitions”, “domains”
• A h/w feature implemented by firmware
• OS need to do nothing special,VMM is in firmware
• Smaller feature set than other types
• Each guest has dedicated h/w
• I/O a challenge as difficult to have enough devices, controllers to dedicate to each
guest
• Sometimes VMM implements a control partition running daemons that other
guests communicate with for shared I/O
• Can provide virtualization-within-virtualization (guest itself can be a VMM with
guests)
• Other types have difficulty doing this
TYPE 0 HYPERVISOR
TYPES OF VMS – TYPE 1 HYPERVISOR

• Commonly found in company datacenters


• In a sense becoming “datacenter operating systems”
• Datacenter managers control and manage OSes in new, sophisticated ways by
controlling the Type 1 hypervisor
• Consolidation of multiple OSes and apps onto less h/w
• Move guests between systems to balance performance
• Snapshots and cloning
• Special purpose operating systems that run natively on h/w
• Rather than providing system call interface, create run and manage guest OSes
• Can run on Type 0 hypervisors but not on other Type 1s
• Run in kernel mode
• Guests generally don’t know they are running in a VM
• Implement device drivers for host h/w because no other component can
• Also provide other traditional OS services like CPU and memory management
TYPES OF VMS – TYPE 1 HYPERVISOR (CONT.)

• Another variation is a general purpose OS that also provides VMM


functionality
• RedHat Enterprise Linux with KVM, Windows with Hyper-V, Oracle Solaris
• Perform normal duties as well as VMM duties
• Typically less feature rich than dedicated Type 1 hypervisors
• In many ways, treat guests OSes as just another process
• Albeit with special handling when guest tries to execute special instructions
TYPES OF VMS – TYPE 2 HYPERVISOR

• Less interesting from an OS perspective


• Very little OS involvement in virtualization
• VMM is simply another process, run and managed by host
• Even the host doesn’t know they are a VMM running guests
• Tend to have poorer overall performance because can’t take advantage of some h/w features
• But also a benefit because require no changes to host OS
• Student could have Type 2 hypervisor on native host, run multiple guests, all on standard host OS
such as Windows, Linux, MacOS
TYPES OF VMS – PARAVIRTUALIZATION

• Does not fit the definition of virtualization – VMM not presenting an exact duplication
of underlying hardware
• But still useful!
• VMM provides services that guest must be modified to use
• Leads to increased performance
• Less needed as hardware support for VMs grows
• Xen, leader in para-virtualized space, adds several techniques
• For example, clean and simple device abstractions
• Efficient I/O
• Good communication between guest and VMM about device I/O
• Each device has circular buffer shared by guest and VMM via shared memory
TYPES OF VMS – EMULATION

• Another (older) way for running one operating system on a different operating system
• Virtualization requires underlying CPU to be same as guest was compiled for
• Emulation allows guest to run on different CPU
• Necessary to translate all guest instructions from guest CPU to native CPU
• Emulation, not virtualization
• Useful when host system has one architecture, guest compiled for other architecture
• Company replacing outdated servers with new servers containing different CPU architecture, but
still want to run old applications
• Performance challenge – order of magnitude slower than native code
• New machines faster than older machines so can reduce slowdown
• Very popular – especially in gaming where old consoles emulated on new

You might also like