Background Information: Execution Stack
嚜濁ackground Information:
Execution Stack
CS 537
Lecture 21A
Virtual Machines
Application
Programs
Interfaces
?Lots of applications
?One OS
Applications
Libraries
System Calls
Operating System
ISA
Execution Hardware
System Interconnect
Hardware
(bus)
I/O devices
and
Networking
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
1
4/11/2011
Virtual Machines
Main
Memory
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
2
? A VMM implements the hardware interface in
software
App
App
App
App
Win
2000
Win
NT
Linux
Win 7
每 All instructions that reference privileged processor state refer
to a software copy
每 All instructions that refer to specific physical resources (e.g.,
memory pages) refer to virtual resources selected by the
VMM
每 All commands/instructions that refer to specific physical
devices refer to software that implements/emulates that
device interface
每 All interrupts from physical devices are handled by VMM
每 VMM must be at higher privilege level than guest VM, which
generally runs in user mode
Intel Architecture
A thin software layer that sits between
Intel hardware and the operating system〞
virtualizing and managing all hardware resources
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
3
4/11/2011
Virtual Machine Monitors (VMMs)
4
? Add features hard to do in an OS
每 Suspend/resume: save state to disk and reload
每 Migration: save state to network file system, reload on
another machine
每 An operating system running within a virtual machine is
called a guest operating system
? Virtual machine monitor (VMM) or hypervisor is
software that implements and supports VMs
? Share hardware
每 Consolidate multiple services from different slow machines
每 VMM determines how to map virtual resources to physical
ones
每 Physical resource may be time-shared, partitioned, or
emulated in software
每 VMM much smaller than a traditional OS;
每 Isolation portion of a VMM is ? 10,000 lines of code
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
Why use VMMs
? A Virtual Machine is a software version of the
hardware state of a computer system
4/11/2011
?Why?
?Talks to single
instance of HW
Virtual Machine Monitors
Virtual Machine Monitor
4/11/2011
Memory
Translation
? Security/isolation
每 Share a single web server with multiple customers (e.g.
,Amazon EC2)
每 Each virtual host gets its own adminstrator/root.
? Run applications for another OS
每 Run Windows apps in a virtual machine on MacOS
5
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
6
1
Implementation Issues
Virtual Machine Types
? Who provides the resource management serves for
the VMM?
? Type 1 / Type 2
每 Type 1 VMMs (called Hypervisors) sit just above the HW and
virtualize the complete hardware
每 another OS
每 the VMM itself
? Example: VM/360, Xen, VMware ESX server
每 Type 2 VMMs run within an OS, and rely on OS services to
manage HW
? What hardware does the VMM expose?
每 The same as a physical machine?
每 Something simpler?
? Example: QEMU, VMware Worksation, Mac Parallels
? How are privileged operations performed?
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
7
Hosted (Type 2) VMware Architecture
Host Mode
VMM Mode
VMware, acting as an
application, uses the host
to access other devices
such as the hard disk,
floppy, or network card
The VMware Virtual
machine monitor allows
each guest OS to directly
access the processor
(direct execution)
Guest OS Applications
Guest Operating System
Host OS Apps
Host OS
NIC
VMware App
Virtual Machine
VMware Driver
Disks
PC Hardware
Virtual Machine Monitor
Memory
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
8
Native (Type 1) Architecture
VMware achieves
both near-native
execution speed
and broad device
support by
transparently
switching*
between Host
Mode and VMM
Mode.
Guest
OS
Guest
OS
Guest
OS
Guest
OS
VMM
VMM
VMM
VMM
Scheduler
Memory
Mgmt
VMkernel
x86 SMP
Hardware
Memory
CPU
SCSI
Driver
Console
OS
Ethernet
Driver
disk
nic
nic
NIC
CPU
*VMware typically switches modes 1000 times per second
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
9
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
10
Virtualization through Ring
Compression
Comparison
? Type 1 (native)
每 All OS*s on the machine more slowly
每 All drivers run in the VMM (VMware) or a special guest OS
(Xen)
每 System management is done in a guest OS
Virtual Machine
Monitor (VMM) runs
at ring 0
? Type 2 (hosted)
Kernel(s) run at
ring 1
每 Host OS runs full speed, guests more slowly
每 All drivers run in host OS, leverage large code base
每 System management is done in host OS
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
3
kernel
user
2
1
0
VMM
Requires that CPU
is virtualizable
11
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
12
2
Virtualization Technology
ISA Impact on Virtual Machines
? Consider x86 PUSHF/POPF instructions
? Basic approach: execute privileged software at
unprivileged level
每 Push flags register on stack or pop it back
每 Flags contains condition codes (good to be able to save/restore)
but also interrupt enable flag (IF)
每 Privileged instructions will trap: I/O, memmgmt
每 Emulate behavior of privileged instructions in software in
VMM
? Pushing flags isn*t privileged
每 Thus, guest OS can read IF and discover it*s not the way it was set
? VMM has complete control over the HW
? VMM isn*t invisible any more
每 Presents another layer of virtual memory under the OS with
a separate page table
每 Presents a different set of devices to the OS
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
每 VMM now doesn*t know what guest wants IF to be
每 Should trap to VMM
? Possible solution: modify code, replacing pushf/popf with special
interrupting instructions
? What happens to instructions that return different
results in priv. mode and normal mode?
4/11/2011
? Popping flags in user mode ignores IF
每 But now guest can read own code and detect VMM
13
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
Classification of processor architectures
14
Virtualizing x86
? Strictly virtualizable processor architectures
? Pure approaches:
每 Can build a VMM based on trap emulation exclusively
每 systems present the interface of real, existing HW and can
run unmodified operating systems
每 Binary translation
? No software running inside the VM cannot determine the presence of
the VMM (short of timing attacks)
每 Examples: IBM S/390, DEC Compaq Intel Alpha, PowerPC
? Convert kernel code into a new binary that calls into VMM for
all privileged instructions / instructions that do something
different between kernel/user mode (VMware)
? (Non-strictly) virtualizable processor architectures
每 Trap emulation alone is not sufficient and/or not complete
? E.g. instructions have different semantics at various levels (sufficient)
? E.g Some software sequences can determine the presence of the VMM
(complete)
每 Emulation
? Emulate all instructions in kernel mode (VirtualPC)
? New hardware
每 Examples: IA-32, IA-64
? Non virtualizable processor architectures
每 Intel VT, AMD Pacifica adds new ring (-1) that traps correctly
每 Basic component missing (e.g. MMU, #)
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
15
4/11/2011
Para-Virtualization
? VMMs present virtual memory to an OS as physical
memory
每 present a new, simpler interface but require OS
modifications
每 Change kernel code to avoid all privileged instructions
每 Issue explicit HyperCalls into VMM to provide these
services
每 Allows the VMM to reclaim pages, swap, give to another VM
? use 3 layer translation: virtual, real, physical
每 OS manages Virtual -> real translation with existing page
tables
每 VMM manages real -> physical translation
? Made possible when:
每 Operating system source is available
? How?
? Open source: Linux and Xen
? OS vendor writes VMM: Microsoft Windows/HyperV, Sun
Solaris LDOM, IBM AIX/LPAR
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
16
Virtualizing Memory
? Para-virtualize side steps the problem
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
每 Trap-on-write to OS page table
每 Shadow page table given to hardware that maps virtual ->
physical directly
17
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
18
3
Virtrual/real/physical memroy
Translating an address
? Given virtual address V:
1. Lookup V in guest OS page table to find P
2. Lookup P in VMM page table to find R
3. use R for memory reference
Process
OS
?
Making this fast: Shadow page tables
1. Create a second page table in VMM containing V -> R
mapping, give to hardware
2. On miss to this table, look at guest OS page table to find P,
look at VMM page table to compute R, ad to shadow page
table
3. When guest OS changes PT, remove from shadow
VMM
Hardware
1.
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
4/11/2011
19
4/11/2011
Virtualizing Devices
But don*t change P->R mapping
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
20
Virtualizing a Network Interface
? Virtualization by Emulation
每 Trap on read/write of device registers
每 Emulate device action in VMM
Physical Ethernet
VMApp
? Virtualization by Replacement
每 Write a new driver for the class of device (e.g., network)
每 Network driver explicitly calls into VMM to perform work
Guest OS
Virtual Network Hub
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
21
4/11/2011
NIC Driver
Virtual Bridge
NIC Driver
Physical NIC
4/11/2011
Host OS
VMDriver
VMM
PC Hardware
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
22
Virtualizing Disks
? Sharing
每 Networking shared a single device through time multiplexing
每 Disks share through space multiplexing
每 Some device might not be shared, but just assigned to a
single VMM, which can run the driver itself
? USB flash drive
? VMM makes a file in the FS act like a disk to the
VMM
每 Can grow incrementally as disk is used
每 Can be copied between systems
? Done by implementing a SCSI or IDE device that
talks to the FS
4/11/2011
? 2004-2011 Ed Lazowska, Hank Levy, Andrea and
Remzi Arpaci-Dussea, Michael Swift, Barton Miller
23
4
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- digital forensics on a virtual machine
- licensing the windows desktop for vdi environments
- background information execution stack
- virtualization
- vmware virtualcenter templates esx server 3 virtualcenter 2
- subvirt implementing malware with virtual machines
- containerized network functions on virtual machines or
- virtualization on synology nas with virtual machine manager
- oracle vm virtualbox overview
- timekeeping in vmware virtual machines
Related searches
- background information on plastic
- background information definition
- background information for science projects
- background information on a person
- background information definition science
- what does background information mean
- example of background information science
- background information in introduction
- background information examples for essays
- background information for an essay
- science project background information example
- background information science project