SlideShare a Scribd company logo
1 of 20
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:
1. A set of storage resources (e.g., registers and memory)
2. A set of instructions that manipulate data held in storage resources
 The definition of the storage resources and the instructions that
manipulate data are documented in what is referred to asInstruction
Set Architecture (ISA)
 Two parts in the ISA are important in the definition of VMs:
1. User ISA: visible to user programs
2. System ISA: visible to supervisor software (e.g., OS)
Ways to Virtualize CPUs
 The key to virtualize a CPU lies in the execution of the guest
instructions, including both system-level and user-level instructions
 Virtualizing a CPU can be achieved in one of two ways:
1. Emulation: the only processor virtualization mechanism available
when the ISA of the guest is different from the ISA of the host
2. Direct native execution: possible only if the ISA of the host is
identical to the ISA of the guest
Emulation
Host
Target ISA
Guest
Source ISA
 Emulation is the process of implementing the interface and
functionality of one system (or subsystem) on a system (or
subsystem) having different interface and functionality
 In other words, emulation allows a machine implementing one ISA
(the target), to reproduce the behavior of a software compiled for
another ISA (the source)
 Emulation can be carried out using:
1. Interpretation
2. Binary translation
Emulated by
Basic Interpretation
Interpreter Code
 Interpretation involves a
4-step cycle (all in software):
1. Fetching a source instruction
2. Analyzing it
3. Performing the required operation
4. Then fetching the next
source instruction
Source Memory State Source Context Block
Program Counter
Condition Codes
Reg 0
Reg 1
•
•
Reg n-1
Code
Data
•
•
•
Stack
Decode-And-Dispatch
Dispatch
Loop
 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
 Decode-and-dispatch is structured
around a central loop that decodes an
instruction and then dispatches it to an
interpretation routine
 It uses a switch statement to call a
number of routines that emulate
individual instructions
Source Code Source Code Interpreter
Routines
Native
Execution
Decode-And-
Dispatch
Interpretation
Decode-And-Dispatch- Drawbacks
Source Code Interpreter
 The central dispatch loop of a decode-and-
dispatch interpreter contains a number of branch
instructions
 Indirect branch for the switch statement
 A branch to the interpreter routine
 A second register indirect branch to return from the
interpreter routine
 And a branch that terminates the loop
 These branches tend to degrade performance
Routines
Decode-And-
Dispatch
Interpretation
Dispatch
Loop
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
 To locate interpreter routines,
a dispatch table and a jump
instruction can be used when
stepping through the
source program
 This scheme is referred to as
indirect threaded interpretation
Source Code
Interpreter
Routines
Decode-And-
Dispatch
Interpretation
Source Code
Interpreter
Routines
Indirect
Threaded
Interpretation
Dispatch
Loop
Indirect Threaded Interpretation-
Drawbacks
Source Code Interpreter
 The dispatch table causes an overhead when
looked up:
 It requires a memory access and a register
indirect branch
 An interpreter routine is invoked every time the same
instruction is encountered
 Thus, the process of examining the instruction and
extracting its various fields is always repeated
Routines
Indirect
Threaded
Interpretation
Predecoding (1)
 It would be more efficient to perform a repeated operation only once
 We can save away the
extracted information of an instruction
in an intermediate form
 The intermediate form can then be
simply reused whenever an instruction
is re-encountered for emulation
 However, a Target Program Counter
(TPC) will be needed to step
through the intermediate code
PowerPC source code
PowerPC program in
predecoded intermediate form
08
2
1
07
03
1
3
08
00
4
3
37
(load word
and zero)
(add)
(store word)
Lwz r1, 8(r2) //load word and zero
Add r3, r3, r1 //r3 = r3 +r1
Stw r3, 0(r4) //store word
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
07 (load word 001048d0 (load word
1 2 08 and zero) 1 2 08 and zero)
3
08
1 03
(add)
3
00104800
1 03
(add)
3
37
4 00
(store word)
3
00104910
4 00
(store word)
 This leads to a scheme referred to as direct threaded interpretation
Direct Threaded Interpretation
Source Code
Interpreter
Routines
Indirect
Threaded
Interpretation
Source Code Intermediate Code
Direct Threaded
Interpretation
Interpreter
Routines
Predecoder
Direct Threaded Interpretation-
Drawbacks
 Direct threaded interpretation still suffers
from major drawbacks:
1. It limits portability because the
intermediate form is dependent on the
exact locations of the interpreter routines
2. The size of predecoded memory image is
proportional to the original source
memory image
3. All source instructions of the same type
are emulated with the same
interpretation routine
Source Code Intermediate Code
Interpreter
Routines
Predecoder
Binary Translation
 Performance can be significantly enhanced by mapping each
individual source binary instruction to its own customized target code
 This process of converting the source binary program into a target
binary program is referred to as binary translation
 Binary translation attempts to amortize the fetch and analysis
costs by:
1. Translating a block of source instructions to a block of target instructions
2. Caching the translated code for repeated use
Binary Translation
Predecoder
Source Code Intermediate Code
Direct Threaded
Interpretation
Interpreter
Routines
Source Code Binary Translated Target
Code
Binary
Translation
Binary
Translator
Static Binary Translation
 It is possible to binary translate a program in its entirety before
executing the program
 This approach is referred to as static binary translation
 However, in real code using conventional ISAs, especially CISC
ISAs, such a static approach can cause problems due to:
 Variable-length instructions
 Data interspersed with instructions
 Pads to align instructions
 Register indirect jumps
Jim indirect to ???
Pad for instruction
alignment
Inst. 1 Inst. 2
Inst. 3 jump
Reg. Data
Inst. 5 Inst. 6
Uncond. Branch Pad
Inst. 8
Data in instruction
stream
Dynamic Binary Translation
 A general solution is to translate the binary while the program is
operating on actual input data (i.e., dynamically) and interpret new
sections of code incrementally as the program reaches them
 This scheme is referred to as dynamic binary translation
Interpreter Translator
Miss
Hit
Emulation
Manager
Code Cache
Source Program
Counter (SPC) to
Target Program
Counter (TPC)
Map Table
Dynamic Binary Translation
Start
with
SPC
Hit in
Table
No
Yes
Get SPC for
Next Block
Write New
SPCTPC
Mapping into
Map Table
Branch to TPC
and Execute
Translated
Block
Use SPC to
Read Instructions
from Source
Memory Image
-----------------------
Interpret,
Translate, and
Place into Code
Cache
Look Up
SPCTPC
in Map Table
Dynamic Binary Translat

More Related Content

Similar to Virtualization summary b.docx

16-bit Microprocessor Design (2005)
16-bit Microprocessor Design (2005)16-bit Microprocessor Design (2005)
16-bit Microprocessor Design (2005)Susam Pal
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in detailskazi_aihtesham
 
SDD Translation
SDD  TranslationSDD  Translation
SDD Translationgavhays
 
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdfConcisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdffeelinggift
 
Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013Buvana Buvana
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programmingMakerere university
 
03. top level view of computer function & interconnection
03. top level view of computer function & interconnection03. top level view of computer function & interconnection
03. top level view of computer function & interconnectionnoman yasin
 
Computer Organization.pptx
Computer Organization.pptxComputer Organization.pptx
Computer Organization.pptxsaimagul310
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csaAnjaan Gajendra
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit ISaranya1702
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language ApekshaShinde6
 

Similar to Virtualization summary b.docx (20)

16-bit Microprocessor Design (2005)
16-bit Microprocessor Design (2005)16-bit Microprocessor Design (2005)
16-bit Microprocessor Design (2005)
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
SDD Translation
SDD  TranslationSDD  Translation
SDD Translation
 
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdfConcisely describe the following terms 40 1. Source code 2. Object c.pdf
Concisely describe the following terms 40 1. Source code 2. Object c.pdf
 
Different addressing mode and risc, cisc microprocessor
Different addressing mode and risc, cisc microprocessorDifferent addressing mode and risc, cisc microprocessor
Different addressing mode and risc, cisc microprocessor
 
Org-&-Arch-2.ppt
Org-&-Arch-2.pptOrg-&-Arch-2.ppt
Org-&-Arch-2.ppt
 
instruction
instruction instruction
instruction
 
CISC & RISC Architecture
CISC & RISC Architecture CISC & RISC Architecture
CISC & RISC Architecture
 
Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
03. top level view of computer function & interconnection
03. top level view of computer function & interconnection03. top level view of computer function & interconnection
03. top level view of computer function & interconnection
 
Design
DesignDesign
Design
 
Chapter1a
Chapter1aChapter1a
Chapter1a
 
Computer Organization.pptx
Computer Organization.pptxComputer Organization.pptx
Computer Organization.pptx
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Unit 2
Unit 2Unit 2
Unit 2
 
Unit 2
Unit 2Unit 2
Unit 2
 
Procedure
ProcedureProcedure
Procedure
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
 

More from shruti533256

More on Emulsion.docx
More on Emulsion.docxMore on Emulsion.docx
More on Emulsion.docxshruti533256
 
More on Virtualization.ppt
More on Virtualization.pptMore on Virtualization.ppt
More on Virtualization.pptshruti533256
 
Virtualization Introduction.ppt
Virtualization Introduction.pptVirtualization Introduction.ppt
Virtualization Introduction.pptshruti533256
 
Virtualization summary a.docx
Virtualization summary a.docxVirtualization summary a.docx
Virtualization summary a.docxshruti533256
 
More on Virtualization 2.pptx
More on Virtualization 2.pptxMore on Virtualization 2.pptx
More on Virtualization 2.pptxshruti533256
 
Virtualization concepts 2.pptx
Virtualization concepts 2.pptxVirtualization concepts 2.pptx
Virtualization concepts 2.pptxshruti533256
 
6- Threaded Interpretation.docx
6- Threaded Interpretation.docx6- Threaded Interpretation.docx
6- Threaded Interpretation.docxshruti533256
 
More on Virtualization 3.pptx
More on Virtualization 3.pptxMore on Virtualization 3.pptx
More on Virtualization 3.pptxshruti533256
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docxshruti533256
 
4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docxshruti533256
 
Course Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docxCourse Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docxshruti533256
 
3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docxshruti533256
 
1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docxshruti533256
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
9-Pumping Lemma.pdf
9-Pumping Lemma.pdf9-Pumping Lemma.pdf
9-Pumping Lemma.pdfshruti533256
 
5-DFA and equivalence with RE.pdf
5-DFA and equivalence with RE.pdf5-DFA and equivalence with RE.pdf
5-DFA and equivalence with RE.pdfshruti533256
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.pptshruti533256
 

More from shruti533256 (19)

More on Emulsion.docx
More on Emulsion.docxMore on Emulsion.docx
More on Emulsion.docx
 
More on Virtualization.ppt
More on Virtualization.pptMore on Virtualization.ppt
More on Virtualization.ppt
 
Virtualization Introduction.ppt
Virtualization Introduction.pptVirtualization Introduction.ppt
Virtualization Introduction.ppt
 
Virtualization summary a.docx
Virtualization summary a.docxVirtualization summary a.docx
Virtualization summary a.docx
 
More on Virtualization 2.pptx
More on Virtualization 2.pptxMore on Virtualization 2.pptx
More on Virtualization 2.pptx
 
Virtualization concepts 2.pptx
Virtualization concepts 2.pptxVirtualization concepts 2.pptx
Virtualization concepts 2.pptx
 
6- Threaded Interpretation.docx
6- Threaded Interpretation.docx6- Threaded Interpretation.docx
6- Threaded Interpretation.docx
 
Overview.ppt
Overview.pptOverview.ppt
Overview.ppt
 
More on Virtualization 3.pptx
More on Virtualization 3.pptxMore on Virtualization 3.pptx
More on Virtualization 3.pptx
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx
 
4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx4-Taxonomy of virtualization.docx
4-Taxonomy of virtualization.docx
 
Course Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docxCourse Plan Virtualization concepts.docx
Course Plan Virtualization concepts.docx
 
3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx3-Types of Virtual Machines.docx
3-Types of Virtual Machines.docx
 
1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx1-Introduction to Virtualization.docx
1-Introduction to Virtualization.docx
 
5-Emulation.docx
5-Emulation.docx5-Emulation.docx
5-Emulation.docx
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
9-Pumping Lemma.pdf
9-Pumping Lemma.pdf9-Pumping Lemma.pdf
9-Pumping Lemma.pdf
 
5-DFA and equivalence with RE.pdf
5-DFA and equivalence with RE.pdf5-DFA and equivalence with RE.pdf
5-DFA and equivalence with RE.pdf
 
2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt2-Chomsky hierarchy of languages.ppt
2-Chomsky hierarchy of languages.ppt
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 

Virtualization summary b.docx

  • 1. CPU Virtualization  Interpretation and Binary Translation  Virtualizable ISAs
  • 2. CPU Virtualization  Interpretation and Binary Translation  Virtualizable ISAs
  • 3. Instruction Set Architecture  Typically, the architecture of a processor defines: 1. A set of storage resources (e.g., registers and memory) 2. A set of instructions that manipulate data held in storage resources  The definition of the storage resources and the instructions that manipulate data are documented in what is referred to asInstruction Set Architecture (ISA)  Two parts in the ISA are important in the definition of VMs: 1. User ISA: visible to user programs 2. System ISA: visible to supervisor software (e.g., OS)
  • 4. Ways to Virtualize CPUs  The key to virtualize a CPU lies in the execution of the guest instructions, including both system-level and user-level instructions  Virtualizing a CPU can be achieved in one of two ways: 1. Emulation: the only processor virtualization mechanism available when the ISA of the guest is different from the ISA of the host 2. Direct native execution: possible only if the ISA of the host is identical to the ISA of the guest
  • 5. Emulation Host Target ISA Guest Source ISA  Emulation is the process of implementing the interface and functionality of one system (or subsystem) on a system (or subsystem) having different interface and functionality  In other words, emulation allows a machine implementing one ISA (the target), to reproduce the behavior of a software compiled for another ISA (the source)  Emulation can be carried out using: 1. Interpretation 2. Binary translation Emulated by
  • 6. Basic Interpretation Interpreter Code  Interpretation involves a 4-step cycle (all in software): 1. Fetching a source instruction 2. Analyzing it 3. Performing the required operation 4. Then fetching the next source instruction Source Memory State Source Context Block Program Counter Condition Codes Reg 0 Reg 1 • • Reg n-1 Code Data • • • Stack
  • 7. Decode-And-Dispatch Dispatch Loop  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  Decode-and-dispatch is structured around a central loop that decodes an instruction and then dispatches it to an interpretation routine  It uses a switch statement to call a number of routines that emulate individual instructions Source Code Source Code Interpreter Routines Native Execution Decode-And- Dispatch Interpretation
  • 8. Decode-And-Dispatch- Drawbacks Source Code Interpreter  The central dispatch loop of a decode-and- dispatch interpreter contains a number of branch instructions  Indirect branch for the switch statement  A branch to the interpreter routine  A second register indirect branch to return from the interpreter routine  And a branch that terminates the loop  These branches tend to degrade performance Routines Decode-And- Dispatch Interpretation Dispatch Loop
  • 9. 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  To locate interpreter routines, a dispatch table and a jump instruction can be used when stepping through the source program  This scheme is referred to as indirect threaded interpretation Source Code Interpreter Routines Decode-And- Dispatch Interpretation Source Code Interpreter Routines Indirect Threaded Interpretation Dispatch Loop
  • 10. Indirect Threaded Interpretation- Drawbacks Source Code Interpreter  The dispatch table causes an overhead when looked up:  It requires a memory access and a register indirect branch  An interpreter routine is invoked every time the same instruction is encountered  Thus, the process of examining the instruction and extracting its various fields is always repeated Routines Indirect Threaded Interpretation
  • 11. Predecoding (1)  It would be more efficient to perform a repeated operation only once  We can save away the extracted information of an instruction in an intermediate form  The intermediate form can then be simply reused whenever an instruction is re-encountered for emulation  However, a Target Program Counter (TPC) will be needed to step through the intermediate code PowerPC source code PowerPC program in predecoded intermediate form 08 2 1 07 03 1 3 08 00 4 3 37 (load word and zero) (add) (store word) Lwz r1, 8(r2) //load word and zero Add r3, r3, r1 //r3 = r3 +r1 Stw r3, 0(r4) //store word
  • 12. 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 07 (load word 001048d0 (load word 1 2 08 and zero) 1 2 08 and zero) 3 08 1 03 (add) 3 00104800 1 03 (add) 3 37 4 00 (store word) 3 00104910 4 00 (store word)  This leads to a scheme referred to as direct threaded interpretation
  • 13. Direct Threaded Interpretation Source Code Interpreter Routines Indirect Threaded Interpretation Source Code Intermediate Code Direct Threaded Interpretation Interpreter Routines Predecoder
  • 14. Direct Threaded Interpretation- Drawbacks  Direct threaded interpretation still suffers from major drawbacks: 1. It limits portability because the intermediate form is dependent on the exact locations of the interpreter routines 2. The size of predecoded memory image is proportional to the original source memory image 3. All source instructions of the same type are emulated with the same interpretation routine Source Code Intermediate Code Interpreter Routines Predecoder
  • 15. Binary Translation  Performance can be significantly enhanced by mapping each individual source binary instruction to its own customized target code  This process of converting the source binary program into a target binary program is referred to as binary translation  Binary translation attempts to amortize the fetch and analysis costs by: 1. Translating a block of source instructions to a block of target instructions 2. Caching the translated code for repeated use
  • 16. Binary Translation Predecoder Source Code Intermediate Code Direct Threaded Interpretation Interpreter Routines Source Code Binary Translated Target Code Binary Translation Binary Translator
  • 17. Static Binary Translation  It is possible to binary translate a program in its entirety before executing the program  This approach is referred to as static binary translation  However, in real code using conventional ISAs, especially CISC ISAs, such a static approach can cause problems due to:  Variable-length instructions  Data interspersed with instructions  Pads to align instructions  Register indirect jumps Jim indirect to ??? Pad for instruction alignment Inst. 1 Inst. 2 Inst. 3 jump Reg. Data Inst. 5 Inst. 6 Uncond. Branch Pad Inst. 8 Data in instruction stream
  • 18. Dynamic Binary Translation  A general solution is to translate the binary while the program is operating on actual input data (i.e., dynamically) and interpret new sections of code incrementally as the program reaches them  This scheme is referred to as dynamic binary translation Interpreter Translator Miss Hit Emulation Manager Code Cache Source Program Counter (SPC) to Target Program Counter (TPC) Map Table
  • 19. Dynamic Binary Translation Start with SPC Hit in Table No Yes Get SPC for Next Block Write New SPCTPC Mapping into Map Table Branch to TPC and Execute Translated Block Use SPC to Read Instructions from Source Memory Image ----------------------- Interpret, Translate, and Place into Code Cache Look Up SPCTPC in Map Table