Lecture18 Class
Lecture18 Class
Discussion on Virtualization
Resource
virtualization
Partitioning and
Multiprocessor
Virtual machine virtualization
types
Virtualization,
para-
Why virtualization, virtualization,
and virtualization virtual machines
properties and hypervisors
Last Session
Background: Computer System
Architectures
1
Application Programs
Instruction Set
Architecture (ISA): 7 & 8 2
3 3 Software
Application Binary Libraries
OS
Interface (ABI): 3 & 7
4 5 6
Memory
Application Drivers Manager Scheduler
Programming ISA
Interface (API): 2 & 7 8 8 8 8 7 7
9
Execution Hardware
Memory Translation
10 10
System Interconnect (bus)
11 11 12 Hardware
Controllers Controllers
13 14
I/O Devices &
Main Memory
Networking
Types of Virtual Machines
As there is a process perspective and a system perspective of machines,
there are also process-level and system-level VMs
1. Process VM
2. System VM
Virtualizing Software
Runtime
OS Virtual Machine
Host
Hardware
Guest OS OS
Virtualizing Software
VMM Virtual Machine
Host Hardware
VMM emulates the ISA used by one hardware platform to another, forming
a system VM
A system VM is capable of executing a system software environment
developed for a different set of hardware
Native and Hosted VM Systems
Guest Guest
Applications Applications
Guest
Applications Guest OS Guest OS
Applications
Nonprivileged
Guest OS VMM VMM modes
Privileged
OS VMM modes
Host OS Host OS
Linux IA-32
VMWare
Windows IA-32
Code Morphing
Crusoe VLIW
Objectives
Discussion on Virtualization
Resource
virtualization
Partitioning and
Multiprocessor
Virtual machine virtualization
types
Virtualization,
para-
Why virtualization, virtualization,
and virtualization virtual machines
properties and hypervisors
Multiprocessor Systems
Multiprocessor systems might have 1000s of processors connected to TBs
of memory and PBs of disk capacity
It is more often the case that applications cannot exploit more than a
fraction of the processors available. The is mainly because of:
P P P P P P P P P P P P
P P P P P P P P P P P P
M M M M M M
I/O I/O I/O I/O I/O I/O
D D D D D D D D D D D D
Physical Partitioning
Physical partitioning allows a partition to own its
resources physically
Failure Isolation: it ensures that in the event of a failure, only the part of
the physical system that houses the failing partition will be affected
P P P P P P P P P P P P
P P P P P P P P P P P P
M M M M M M
I/O I/O I/O I/O I/O I/O
D D D D D D D D D D D D
Logical Partitioning
With logical partitioning it is permissible for two partitions to share
the resources of a single system board
P P P P P P P P P P P P
Memory
I/O
Objectives
Discussion on Virtualization
Resource
virtualization
Partitioning and
Multiprocessor
Virtual machine virtualization
types
Virtualization,
para-
Why virtualization, virtualization,
and virtualization virtual machines
properties and hypervisors
Resource Virtualization
Resource Virtualization
22
CPU Virtualization
Interpretation and Binary Translation
Virtualizable ISAs
CPU Virtualization
Interpretation and Binary Translation
Virtualizable ISAs
Instruction Set Architecture
Typically, the architecture of a processor defines:
Source ISA
Emulation can be carried out using:
Emulated by
1. Interpretation
Host
2. Binary translation
Target ISA
Basic Interpretation
Source Memory State Source Context Block
Interpretation involves a
4-step cycle (all in software): Code
Program Counter
Condition Codes
Data Reg 1
2. Analyzing it •
•
•
3. Performing the required operation Reg n-1
•
•
4. Then fetching the next
source instruction Stack Interpreter Code
Decode-And-Dispatch
A simple interpreter, referred to as decode-and-dispatch, operates by stepping
through the source program (instruction by instruction) reading and modifying
the source state
Source Code Source Code Interpreter
Routines
Decode-and-dispatch is structured
around a central loop that decodes an
Dispatch
instruction and then dispatches it to an Loop
interpretation routine
Decode-And-
Native
Dispatch
Execution
Interpretation
Decode-And-Dispatch- Drawbacks
Source Code Interpreter
The central dispatch loop of a decode-and- Routines
Decode-And-
Dispatch
Interpretation
Indirect Threaded Interpretation
To avoid some of the branches, a portion of the dispatch code can be
appended (threaded) to the end of each of the interpreter routines
Decode-And- Indirect
Dispatch Threaded
Interpretation Interpretation
Indirect Threaded Interpretation-
Drawbacks Interpreter
Source Code
Routines
The dispatch table causes an overhead when
looked up:
PowerPC program in
The intermediate form can then be predecoded intermediate form
simply reused whenever an instruction
is re-encountered for emulation 07 (load word
1 2 08 and zero)
08
However, a Target Program Counter 3 1 03
(add)
(TPC) will be needed to step
through the intermediate code 37 (store word)
3 4 00
Predecoding (2)
To avoid a memory lookup whenever the dispatch table is accessed,
the opcode in the intermediate form can be replaced with the address
of the interpreter routine
Predecoder
Indirect
Direct Threaded
Threaded
Interpretation
Interpretation
Direct Threaded Interpretation-
Drawbacks
Direct threaded interpretation still suffers Interpreter
Source Code Intermediate Code
from major drawbacks: Routines
Binary
Predecoder Translator
Direct Threaded
Interpretation Binary
Translation
Static Binary Translation
It is possible to binary translate a program in its entirety before
executing the program
Data in instruction
Variable-length instructions Inst. 1 Inst. 2
stream
Inst. 3 jump
Data interspersed with instructions
Reg. Data
Pads to align instructions Inst. 5 Inst. 6
Pad for instruction
Register indirect jumps Uncond. Branch Pad
alignment
Inst. 8
Source Program
Counter (SPC) to
Target Program
Counter (TPC)
Map Table
Interpreter Translator
Miss
Hit
Emulation
Manager
Code Cache
Dynamic Binary Translation
Start
with
SPC
Look Up
SPCTPC
in Map Table
No Use SPC to
Hit in
Table Read Instructions
from Source
Memory Image
Yes -----------------------
Interpret,
Branch to TPC
Translate, and
and Execute
Place into Code
Translated
Cache
Block
Write New
Get SPC for SPCTPC
Next Block Mapping into
Map Table
Next Class
Discussion on Virtualization
Resource
virtualization
Partitioning and
Multiprocessor
Virtual machine virtualization
types
Virtualization,
para-
Why virtualization, virtualization,
and virtualization virtual machines
properties and hypervisors