100% found this document useful (1 vote)
186 views28 pages

Chapter 18 - Virtual Machines

The document discusses virtual machines and their implementation. It covers the overview of virtual machines including their components and models. It also discusses the benefits of virtualization including resource sharing and optimization. Finally, it examines different types of virtual machines and hypervisors.

Uploaded by

Wes Mena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
186 views28 pages

Chapter 18 - Virtual Machines

The document discusses virtual machines and their implementation. It covers the overview of virtual machines including their components and models. It also discusses the benefits of virtualization including resource sharing and optimization. Finally, it examines different types of virtual machines and hypervisors.

Uploaded by

Wes Mena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Chapter 18: Virtual Machines

Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018
Chapter 18: Virtual Machines
▪ Overview
▪ History
▪ Benefits and Features
▪ Building Blocks
▪ Types of Virtual Machines and Their Implementations
▪ Virtualization and Operating-System Components
▪ Examples

Operating System Concepts – 10th Edition 18.2 Silberschatz, Galvin and Gagne ©2018
Why virtualize?
▪ Resource sharing, separation and optimization
• Machines have a lot of capacity
• Less idle time
▪ VM do not possess actual hardware
▪ Development environment
▪ Consolidation
• Reduces the demand for (Heating, ventilation, and air conditioning)
HVAC, power, rack/floor space
▪ Maximizing uptime
• Ej. blue screen of death (BSoD)
• Elasticity: provisioning resources when and where needed.
▪ Migration
• Moving server/MVs from one place to another
▪ Legacy servers
▪ Network impact: performance, resiliency, scalability and flexibility

Operating System Concepts – 10th Edition 18.3 Silberschatz, Galvin and Gagne ©2018
Virtualization history

https://searchservervirtualization.techtarget.com/feature/The-history-of-virtualization-and-its-mark-on-
data-center-management

Operating System Concepts – 10th Edition 18.4 Silberschatz, Galvin and Gagne ©2018
Overview
▪ The fundamental idea behind a virtual machine is to abstract the hardware
of a single computer (the CPU, memory, disk drives, network interface cards,
and so forth) into several different execution environments, thereby creating
the illusion that each separate environment is running on its own private
computer

▪ 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
4 (Except in the case of paravirtualization)
• Guest – process provided with virtual copy of the host
4 Usually an operating system
▪ Single physical machine can run multiple operating systems concurrently,
each in its own virtual machine

Operating System Concepts – 10th Edition 18.5 Silberschatz, Galvin and Gagne ©2018
System Models

Non-virtual machine Virtual machine

Operating System Concepts – 10th Edition 18.6 Silberschatz, Galvin and Gagne ©2018
Implementation of VMMs
▪ Vary greatly, with options including:
• Type 0 hypervisors - Hardware-based solutions that provide support
for virtual machine creation and management via firmware
4 IBM LPARs and Oracle LDOMs are examples
• Type 1 hypervisors - Operating-system-like software built to provide
virtualization
4 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
4 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
4 Including VMware Workstation and Fusion, Parallels Desktop, and
Oracle VirtualBox

Operating System Concepts – 10th Edition 18.7 Silberschatz, Galvin and Gagne ©2018
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
4 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

Operating System Concepts – 10th Edition 18.8 Silberschatz, Galvin and Gagne ©2018
Implementation of VMMs (Cont.)

• Application containment - Not virtualization at all but rather


provides virtualization-like features by segregating applications from the
operating system, making them more secure, manageable
4 Including Oracle Solaris Zones, BSD Jails, and IBM AIX WPARs
▪ Much variation due to breadth, depth and importance of virtualization in
modern computing

Operating System Concepts – 10th Edition 18.9 Silberschatz, Galvin and Gagne ©2018
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
4 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, …

Operating System Concepts – 10th Edition 18.10 Silberschatz, Galvin and Gagne ©2018
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

Operating System Concepts – 10th Edition 18.11 Silberschatz, Galvin and Gagne ©2018
Types of Virtual Machines
and Implementations
▪ Many variations as well as HW details
▪ 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

Operating System Concepts – 10th Edition 18.22 Silberschatz, Galvin and Gagne ©2018
Types of VMs – Type 0 Hypervisor
▪ Old idea, under many names by HW manufacturers
• “partitions”, “domains”
• A HW feature implemented by firmware
• Smaller feature set than other types
• Each guest has dedicated HW
▪ 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

Operating System Concepts – 10th Edition 18.23 Silberschatz, Galvin and Gagne ©2018
Type 0 Hypervisor

Operating System Concepts – 10th Edition 18.24 Silberschatz, Galvin and Gagne ©2018
Types of VMs – Type 1 Hypervisor
▪ In a sense becoming “datacenter operating systems”
▪ Special purpose operating systems that run natively on HW
• 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 HW because no other component can
• Also provide other traditional OS services like CPU and memory
management

Operating System Concepts – 10th Edition 18.25 Silberschatz, Galvin and Gagne ©2018
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

Operating System Concepts – 10th Edition 18.26 Silberschatz, Galvin and Gagne ©2018
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
4 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 HW features
• But also a benefit because require no changes to host OS
4 Student could have Type 2 hypervisor on native host, run multiple
guests, all on standard host OS such as Windows, Linux, MacOS

Operating System Concepts – 10th Edition 18.27 Silberschatz, Galvin and Gagne ©2018
Types of VMs –
Programming Environment Virtualization
▪ Also not-really-virtualization but using same techniques, providing similar
features
▪ Programming language is designed to run within custom-built virtualized
environment
• For example Oracle Java has many features that depend on running in
Java Virtual Machine (JVM)
▪ In this case virtualization is defined as providing APIs that define a set of
features made available to a language and programs written in that language
to provide an improved execution environment
▪ JVM compiled to run on many systems (including some smart phones even)
▪ Programs written in Java run in the JVM no matter the underlying system
▪ Similar to interpreted languages

Operating System Concepts – 10th Edition 18.31 Silberschatz, Galvin and Gagne ©2018
Virtualization and
Operating-System Components
▪ Now look at operating system aspects of virtualization
• CPU scheduling, memory management, I/O, storage, and unique VM
migration feature
4 How do VMMs schedule CPU use when guests believe they have
dedicated CPUs?
4 How can memory management work when many guests require large
amounts of memory?

Operating System Concepts – 10th Edition 18.35 Silberschatz, Galvin and Gagne ©2018
OS Component – I/O
▪ Easier for VMMs to integrate with guests because I/O has lots of variation
• Already somewhat segregated / flexible via device drivers
• VMM can provide new devices and device drivers

▪ Networking also complex as VMM and guests all need network access
• VMM can bridge guest to network (allowing direct access)
• And / or provide network address translation (NAT)
4 NAT address local to machine on which guest is running, VMM
provides address translation to guest to hide its address

Operating System Concepts – 10th Edition 18.38 Silberschatz, Galvin and Gagne ©2018
OS Component – Live Migration
▪ Taking advantage of VMM features leads to new functionality not found on
general operating systems such as live migration
▪ Running guest can be moved between systems, without interrupting user access to
the guest or its apps
▪ Very useful for resource management, maintenance downtime windows, etc.
1. The source VMM establishes a connection with the target VMM
2. The target creates a new guest by creating a new VCPU, etc.
3. The source sends all read-only guest memory pages to the target
4. The source sends all read-write pages to the target, marking them as clean
5. The source repeats step 4, as during that step some pages were probably
modified by the guest and are now dirty
6. When cycle of steps 4 and 5 becomes very short, source VMM freezes guest,
sends VCPU’s final state, sends other state details, sends final dirty pages, and
tells target to start running the guest
4 Once target acknowledges that guest running, source terminates guest

Operating System Concepts – 10th Edition 18.42 Silberschatz, Galvin and Gagne ©2018
Live Migration of Guest Between Servers

Operating System Concepts – 10th Edition 18.43 Silberschatz, Galvin and Gagne ©2018
Examples - VMware
▪ VMware Workstation runs on x86, provides VMM for guests
▪ Runs as application on other native, installed host operating system -> Type
2
▪ Lots of guests possible, including Windows, Linux, etc. all runnable
concurrently (as resources allow)
▪ Virtualization layer abstracts underlying HW, providing guest with is own
virtual CPUs, memory, disk drives, network interfaces, etc.
▪ Physical disks can be provided to guests, or virtual physical disks (just files
within host file system)

Operating System Concepts – 10th Edition 18.44 Silberschatz, Galvin and Gagne ©2018
VMware Workstation Architecture

Operating System Concepts – 10th Edition 18.45 Silberschatz, Galvin and Gagne ©2018
Examples – Java Virtual Machine
▪ Example of programming-environment virtualization
▪ Very popular language / application environment invented by Sun
Microsystems in 1995
▪ Write once, run anywhere
▪ Includes language specification (Java), API library, Java virtual machine
(JVM)
▪ Java objects specified by class construct, Java program is one or more
objects
▪ Each Java object compiled into architecture-neutral bytecode output
(.class) which JVM class loader loads
▪ JVM compiled per architecture, reads bytecode and executes
▪ Includes garbage collection to reclaim memory no longer in use
▪ Made faster by just-in-time (JIT) compiler that turns bytecodes into native
code and caches them

Operating System Concepts – 10th Edition 18.46 Silberschatz, Galvin and Gagne ©2018
The Java Virtual Machine

Operating System Concepts – 10th Edition 18.47 Silberschatz, Galvin and Gagne ©2018
Virtualization Research
▪ Very popular technology with active research
▪ Driven by uses such as server consolidation
▪ Unikernels, built on library operating systems
• Aim to improve efficiency and security
• Specialized machine images using one address space, shrinking attack
surface and resource footprint of deployed applications
• In essence, compile application, libraries called, and used kernel
services into single binary that runs in a virtual environment
▪ Better control of processes available via projects like Quest-V
• Real time execution and fault tolerance via virtualization instructions
• Partitioning hypervisors partition physical resources amongst guests,
fully-committing all resources (rather than overcommitting)
• For example a Linux system that lacks real-time capabilities for safety-
and security-critical tasks can be extended with a lightweight real-time
OS running in its own VM

Operating System Concepts – 10th Edition 18.48 Silberschatz, Galvin and Gagne ©2018
End of Chapter 18

Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018

You might also like