0% found this document useful (0 votes)
50 views29 pages

OS Unit 5

This document discusses virtual machines and mobile operating systems. It covers virtual machines, their components like the host, virtual machine manager, and guest. It describes the benefits of virtual machines like protection, mobility, and consolidation. It also discusses the different types of virtual machine implementations like type 0, 1, and 2 hypervisors and paravirtualization. Finally, it covers virtual machine lifecycles and building blocks like trap-and-emulate techniques.

Uploaded by

prins l
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
0% found this document useful (0 votes)
50 views29 pages

OS Unit 5

This document discusses virtual machines and mobile operating systems. It covers virtual machines, their components like the host, virtual machine manager, and guest. It describes the benefits of virtual machines like protection, mobility, and consolidation. It also discusses the different types of virtual machine implementations like type 0, 1, and 2 hypervisors and paravirtualization. Finally, it covers virtual machine lifecycles and building blocks like trap-and-emulate techniques.

Uploaded by

prins l
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/ 29

UNIT 5

VIRTUAL MACHINES AND MOBILE OS


Virtual Machines
• 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
Virtual Machines

Non-virtual machine Virtual machine


History
• First appeared in IBM mainframes in 1972
• Allowed multiple users to share a batch-oriented system
• Formal definition of virtualization helped move it beyond IBM
1.A VMM provides an environment for programs that is essentially identical to the
original machine
2.Programs running within that environment show only minor performance decreases
3.The VMM is in complete control of system resources
• In late 1990s Intel CPUs fast enough for researchers to try virtualizing on
general purpose PCs
• Xen and VMware created technologies, still used today
• Virtualization has expanded to many OSes, CPUs, VMMs
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
Types and 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
• 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
• Includeing 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
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 HW details


 Assume VMMs take advantage of HW features
HW 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 resouces
 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 HW manufacturers


• “partitions”, “domains”
• A HW feature implemented by firmware
• OS need to nothing special, VMM is in 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
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 HW
• Move guests between systems to balance performance
• Snapshots and cloning
• 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
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 HW 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 paravirtualized 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
Xen I/O via Shared Circular Buffer
Types of VMs – Paravirtualization (cont.)

• Xen, leader in Para virtualized space, adds several techniques


(Cont.)
Memory management does not include nested page tables
Each guest has own read-only tables
Guest uses hypercall (call to hypervisor) when page-table changes needed
• Paravirtualization allowed virtualization of older x86 CPUs (and
others) without binary translation
• Guest had to be modified to use run on paravirtualized VMM
• But on modern CPUs Xen no longer requires guest modification ->
no longer paravirtualization
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
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
Types of VMs – Application Containment

• Some goals of virtualization are segregation of apps, performance and


resource management, easy start, stop, move, and management of them
• Can do those things without full-fledged virtualization
• If applications compiled for the host operating system, don’t need full
virtualization to meet these goals
• Oracle containers / zones for example create virtual layer between OS
and apps
• Only one kernel running – host OS
• OS and devices are virtualized, providing resources within zone with impression
that they are only processes on system
• Each zone has its own applications; networking stack, addresses, and ports; user
accounts, etc
• CPU and memory resources divided between zones
• Zone can have its own scheduler to use those resources
Virtualization and Operating-System Components

• OS Virtualization
• With the help of OS virtualization nothing is pre-installed or permanently loaded on the local device and no-hard
disk is needed. Everything runs from the network using a kind of virtual disk. This virtual disk is actually a disk
image file stored on a remote server, SAN (Storage Area Network) or NAS (Non-volatile Attached Storage). The
client will be connected by the network to this virtual disk and will boot with the Operating System installed on
the virtual disk.
• How does OS Virtualization works?
• Components needed for using OS Virtualization in the infrastructure are given below:
• The first component is the OS Virtualization server. This server is the center point in the OS Virtualization
infrastructure. The server manages the streaming of the information on the virtual disks for the client and also
determines which client will be connected to which virtual disk (using a database, this information is stored). Also
the server can host the storage for the virtual disk locally or the server is connected to the virtual disks via a SAN
(Storage Area Network). In high availability environments there can be more OS Virtualization servers to create
no redundancy and load balancing. The server also ensures that the client will be unique within the infrastructure.
• Secondly, there is a client which will contact the server to get connected to the virtual disk and asks for
components stored on the virtual disk for running the operating system.
Virtualization and Operating-System Components

• The available supporting components are database for storing the


configuration and settings for the server, a streaming service for the virtual
disk content, a (optional) TFTP service and a (also optional) PXE boot service
for connecting the client to the OS Virtualization servers.
• As it is already mentioned that the virtual disk contains an image of a physical
disk from the system that will reflect to the configuration and the settings of
those systems which will be using the virtual disk. When the virtual disk is
created then that disk needs to be assigned to the client that will be using this
disk for starting. The connection between the client and the disk is made
through the administrative tool and saved within the database. When a client
has a assigned disk, the machine can be started with the virtual disk using the
following process as displayed in the given below Figure:
Virtualization and Operating-System Components
Mobile Operating System-ios and Android
• A mobile operating system is an operating system that helps to run other
application software on mobile devices. It is the same kind of software as the
famous computer operating systems like Linux and Windows, but now they are
light and simple to some extent.
• The operating system found on smartphones include Symbian OS, iPhone OS,
RIM's BlackBerry, Windows Mobile, Palm WebOS, Android, and Maemo.
Android, WebOS, and Maemo are all derived from Linux. The iPhone OS
originated from BSD and NeXTSTEP, which are related to Unix.
• It combines the beauty of computer and hand use devices. It typically contains a
cellular built-in modem and SIM tray for telephony and internet connections. If
you buy a mobile, the manufacturer company chooses the OS for that specific
device.
Mobile Operating System-ios and Android

You might also like