SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
National School of Computer Sciences

Translation cache policies for dynamic binary translation
Saber FERJANI
TIMA Laboratory - SLS Group

18 Avril 2013

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

1 / 25
Who I am ?
Academic & Professional Cursus
2010-2013 : Student at National School of Computer Sciences - Tunisia.
2011/2012 : Robotic team leader, participation to many competitions.
June-July 2011 : Intern at Alpha Technology, Design of many PCB layout
including QFP, SO, SMT and through hole components.
July-August 2012 : Intern at STMicroelectronics : Developing software for a
Hygrometer and an Altimeter, for STM32F3 microcontroller

http ://about.me/ferjani
Saber F. (TIMA SLS )

ENSI

18 Avril 2013

2 / 25
Context

Why ?
Hardware design is taking more and more time,
Software development should start earlier,
Instruction Set Simulators (ISS) handles the simulation of processors, named
target, on a machine with a different architecture, named host.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

3 / 25
Context

Why ?
Hardware design is taking more and more time,
Software development should start earlier,
Instruction Set Simulators (ISS) handles the simulation of processors, named
target, on a machine with a different architecture, named host.

How ?
Cross Compilation.
Interpretive translation.
Dynamic Binary Translation.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

3 / 25
Terminology

Simulator : just duplicate the behavior of the system.
Emulator : duplicate the inner workings of the system.
TB : Translated Bloc.
IR : Intermediate representation (also called op-code)

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

4 / 25
Outline

1

Introduction

2

Cache Algorithms

3

Qemu internals

4

Preliminary Results

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

5 / 25
I- Introduction

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

6 / 25
Qemu Overview
Generic and open source machine emulator and virtualizer,
Created by Fabrice Bellard in 2003,
uses portable dynamic translation,
Supported Targets : x86, arm, mips, sh4, cris, sparc, powerpc, nds32...

Qemu Features
Just-in-time (JIT) compilation support,
Self-modifying code support,
Direct block chaining.
Saber F. (TIMA SLS )

ENSI

18 Avril 2013

7 / 25
Subject

Problematic
Simulation speed is mainly affected by reuse of TB,
Current policy just flush the entire cache when it is full,
We need to enhance translation cache policy in order to maximize TB reuse.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

8 / 25
II- Cache Algorithms

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

9 / 25
Optimal cache algorithm
Evict entry that will not be used for the longest time.
Unfeasible in practice, since we cannot really know future !

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

10 / 25
Optimal cache algorithm
Evict entry that will not be used for the longest time.
Unfeasible in practice, since we cannot really know future !

First In First Out
Most simple cache replacement policy,
Entry remain in memory a constant duration.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

10 / 25
Optimal cache algorithm
Evict entry that will not be used for the longest time.
Unfeasible in practice, since we cannot really know future !

First In First Out
Most simple cache replacement policy,
Entry remain in memory a constant duration.

Least Recently Used
Enhancement to FIFO.
Each time an entry is referenced, it is moved to the end of the queue.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

10 / 25
Optimal cache algorithm
Evict entry that will not be used for the longest time.
Unfeasible in practice, since we cannot really know future !

First In First Out
Most simple cache replacement policy,
Entry remain in memory a constant duration.

Least Recently Used
Enhancement to FIFO.
Each time an entry is referenced, it is moved to the end of the queue.

Least Frequently Used
Exploit the overall popularity rather than temporal locality.
Least referenced entry is always chosen for eviction.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

10 / 25
III- Qemu internals

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

11 / 25
Dynamic Binary Translation in Qemu

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

12 / 25
Dynamic Binary Translation in Qemu

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

12 / 25
Dynamic Binary Translation in Qemu

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

12 / 25
Bloc chaining

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

13 / 25
Bloc chaining

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

13 / 25
lookup tb
by target pc

no Translate one
basic block

Cached ?
yes

execute tb

chain it
to existed
basic block

Exception
handling
Saber F. (TIMA SLS )

ENSI

18 Avril 2013

14 / 25
lookup tb
by target pc

no Translate one
basic block

Cached ?
yes

execute tb

chain it
to existed
basic block

Exception
handling
Saber F. (TIMA SLS )

ENSI

18 Avril 2013

15 / 25
Focus on (Translate one basic block)

try to allocate
space for tb

sucess ?

no

Flush entire
translation
cache

yes

allocate
space for tb
(cannot fail!)

generate op
& host code

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

16 / 25
Implementation constraints

Variable TB size
In basics cache algorithms, evicting one entry is always sufficient to bring an other,
but in our case, TB size is not only variable, but also unknown during allocation.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

17 / 25
Implementation constraints

Variable TB size
In basics cache algorithms, evicting one entry is always sufficient to bring an other,
but in our case, TB size is not only variable, but also unknown during allocation.

Self modifying code
When the executed code modify it self, the TB is re-translated into different
space. thus result in many memory allocation while only the last one is needed.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

17 / 25
Implementation constraints

Variable TB size
In basics cache algorithms, evicting one entry is always sufficient to bring an other,
but in our case, TB size is not only variable, but also unknown during allocation.

Self modifying code
When the executed code modify it self, the TB is re-translated into different
space. thus result in many memory allocation while only the last one is needed.

Low overhead
We need to predict if the the replacement cache overhead remain below the cost
of cache flush, otherwise, we should simply flush the entire cache.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

17 / 25
IV- Preliminary Results

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

18 / 25
Goals
Simulate LRU & LFU Algorithms,
Compare cache hit ratio,
Evaluate overhead of each algorithm.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

19 / 25
Goals
Simulate LRU & LFU Algorithms,
Compare cache hit ratio,
Evaluate overhead of each algorithm.

Assumptions
We ignore TB size & cache size,
Quota of retained entries is 1/5,
Cache size is just limited by number of TB,

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

19 / 25
Execution ratio = (executions/translation)

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

20 / 25
LFU cache hit ratio

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

21 / 25
LRU cache hit ratio

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

22 / 25
Perspectives

find a suitable cache replacement policy that take care of implementation
constraints.
use a dynamically variable quota for retained entries.
add small op-code buffer to optimize re-translation of self modifying code.
divide translation cache into multiple space to optimize partial cache flush.

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

23 / 25
Bibliography

QEMU Just-In-Time Code Generator and System Emulation - cmchao
(March 15,2010).
QEMU internals - Chad D. Kersey (January 28, 2009).
QEMU, a Fast and Portable Dynamic Translator - Fabrice Bellard (USENIX
2005 Annual).
Performance Evaluation of Traditional Caching Policies on A Large System
with Petabytes of Data - 2012 IEEE Seventh International Conference on
Networking, Architecture, and Storage

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

24 / 25
Thanks for your attention !

Feel free to ask any question !

Saber F. (TIMA SLS )

ENSI

18 Avril 2013

25 / 25

Weitere ähnliche Inhalte

Ähnlich wie Translation Cache Policies for Dynamic Binary Translation

Symmetrix local replication
Symmetrix local replicationSymmetrix local replication
Symmetrix local replicationSundeep Rao
 
Iaetsd march c algorithm for embedded memories in fpga
Iaetsd march c algorithm for embedded memories in fpgaIaetsd march c algorithm for embedded memories in fpga
Iaetsd march c algorithm for embedded memories in fpgaIaetsd Iaetsd
 
Boston meetup : MySQL Innodb Cluster - May 1st 2017
Boston meetup : MySQL Innodb Cluster - May 1st  2017Boston meetup : MySQL Innodb Cluster - May 1st  2017
Boston meetup : MySQL Innodb Cluster - May 1st 2017Frederic Descamps
 
Low memory footprint programs-iSeries
Low memory footprint programs-iSeriesLow memory footprint programs-iSeries
Low memory footprint programs-iSeriesPrithiviraj Damodaran
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W mattersAlexandre Moneger
 
Firebird2.5 Benchmarks(English)20091031
Firebird2.5 Benchmarks(English)20091031Firebird2.5 Benchmarks(English)20091031
Firebird2.5 Benchmarks(English)20091031Tsutomu Hayashi
 
Jstorm introduction-0.9.6
Jstorm introduction-0.9.6Jstorm introduction-0.9.6
Jstorm introduction-0.9.6longda feng
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersAlexandre Moneger
 
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis ClusterSymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis ClusterAndré Rømcke
 
Presto At Arm Treasure Data - 2019 Updates
Presto At Arm Treasure Data - 2019 UpdatesPresto At Arm Treasure Data - 2019 Updates
Presto At Arm Treasure Data - 2019 UpdatesTaro L. Saito
 
Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS languageKiwamu Okabe
 
microprocessor Lec 01 mic
microprocessor Lec 01 micmicroprocessor Lec 01 mic
microprocessor Lec 01 miciqbal ahmad
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterTim Ellison
 
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...DataWorks Summit
 
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud WorldPolicy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud WorldApcera
 
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)South Tyrol Free Software Conference
 
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim Ledermüller
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim LedermüllerOSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim Ledermüller
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim LedermüllerNETWAYS
 

Ähnlich wie Translation Cache Policies for Dynamic Binary Translation (20)

Symmetrix local replication
Symmetrix local replicationSymmetrix local replication
Symmetrix local replication
 
Iaetsd march c algorithm for embedded memories in fpga
Iaetsd march c algorithm for embedded memories in fpgaIaetsd march c algorithm for embedded memories in fpga
Iaetsd march c algorithm for embedded memories in fpga
 
Boston meetup : MySQL Innodb Cluster - May 1st 2017
Boston meetup : MySQL Innodb Cluster - May 1st  2017Boston meetup : MySQL Innodb Cluster - May 1st  2017
Boston meetup : MySQL Innodb Cluster - May 1st 2017
 
Low memory footprint programs-iSeries
Low memory footprint programs-iSeriesLow memory footprint programs-iSeries
Low memory footprint programs-iSeries
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters
 
Firebird2.5 Benchmarks(English)20091031
Firebird2.5 Benchmarks(English)20091031Firebird2.5 Benchmarks(English)20091031
Firebird2.5 Benchmarks(English)20091031
 
Syntutic
SyntuticSyntutic
Syntutic
 
P.I.Z.Z.A.: Rationale Behind FPGA
P.I.Z.Z.A.: Rationale Behind FPGAP.I.Z.Z.A.: Rationale Behind FPGA
P.I.Z.Z.A.: Rationale Behind FPGA
 
Jstorm introduction-0.9.6
Jstorm introduction-0.9.6Jstorm introduction-0.9.6
Jstorm introduction-0.9.6
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
 
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis ClusterSymfonyCon 2019:   Head first into Symfony Cache, Redis & Redis Cluster
SymfonyCon 2019: Head first into Symfony Cache, Redis & Redis Cluster
 
Presto At Arm Treasure Data - 2019 Updates
Presto At Arm Treasure Data - 2019 UpdatesPresto At Arm Treasure Data - 2019 Updates
Presto At Arm Treasure Data - 2019 Updates
 
Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS language
 
microprocessor Lec 01 mic
microprocessor Lec 01 micmicroprocessor Lec 01 mic
microprocessor Lec 01 mic
 
Prefixing Education
Prefixing EducationPrefixing Education
Prefixing Education
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
 
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud WorldPolicy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
Policy-based Cloud Storage: Persisting Data in a Multi-Site, Multi-Cloud World
 
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)
SFSCON23 - Chris Mair - Self-hosted, Open Source Large Language Models (LLMs)
 
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim Ledermüller
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim LedermüllerOSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim Ledermüller
OSDC 2019 | Storage Wars – Using Ceph since Firefly by Achim Ledermüller
 

Mehr von Saber Ferjani

Localization as a service in an Intelligent Transport System
Localization as a service in an Intelligent Transport SystemLocalization as a service in an Intelligent Transport System
Localization as a service in an Intelligent Transport SystemSaber Ferjani
 
Translation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationTranslation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationSaber Ferjani
 
Management de la qualité
Management de la qualitéManagement de la qualité
Management de la qualitéSaber Ferjani
 
La sécurité informatique
La sécurité informatiqueLa sécurité informatique
La sécurité informatiqueSaber Ferjani
 

Mehr von Saber Ferjani (8)

Saber Ferjani
Saber FerjaniSaber Ferjani
Saber Ferjani
 
Localization as a service in an Intelligent Transport System
Localization as a service in an Intelligent Transport SystemLocalization as a service in an Intelligent Transport System
Localization as a service in an Intelligent Transport System
 
Translation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationTranslation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary Translation
 
Wireless Meter Bus
Wireless Meter BusWireless Meter Bus
Wireless Meter Bus
 
Future Internet
Future InternetFuture Internet
Future Internet
 
Management de la qualité
Management de la qualitéManagement de la qualité
Management de la qualité
 
SystemC
SystemCSystemC
SystemC
 
La sécurité informatique
La sécurité informatiqueLa sécurité informatique
La sécurité informatique
 

Kürzlich hochgeladen

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...HetalPathak10
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 

Kürzlich hochgeladen (20)

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
 
Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 

Translation Cache Policies for Dynamic Binary Translation

  • 1. National School of Computer Sciences Translation cache policies for dynamic binary translation Saber FERJANI TIMA Laboratory - SLS Group 18 Avril 2013 Saber F. (TIMA SLS ) ENSI 18 Avril 2013 1 / 25
  • 2. Who I am ? Academic & Professional Cursus 2010-2013 : Student at National School of Computer Sciences - Tunisia. 2011/2012 : Robotic team leader, participation to many competitions. June-July 2011 : Intern at Alpha Technology, Design of many PCB layout including QFP, SO, SMT and through hole components. July-August 2012 : Intern at STMicroelectronics : Developing software for a Hygrometer and an Altimeter, for STM32F3 microcontroller http ://about.me/ferjani Saber F. (TIMA SLS ) ENSI 18 Avril 2013 2 / 25
  • 3. Context Why ? Hardware design is taking more and more time, Software development should start earlier, Instruction Set Simulators (ISS) handles the simulation of processors, named target, on a machine with a different architecture, named host. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 3 / 25
  • 4. Context Why ? Hardware design is taking more and more time, Software development should start earlier, Instruction Set Simulators (ISS) handles the simulation of processors, named target, on a machine with a different architecture, named host. How ? Cross Compilation. Interpretive translation. Dynamic Binary Translation. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 3 / 25
  • 5. Terminology Simulator : just duplicate the behavior of the system. Emulator : duplicate the inner workings of the system. TB : Translated Bloc. IR : Intermediate representation (also called op-code) Saber F. (TIMA SLS ) ENSI 18 Avril 2013 4 / 25
  • 6. Outline 1 Introduction 2 Cache Algorithms 3 Qemu internals 4 Preliminary Results Saber F. (TIMA SLS ) ENSI 18 Avril 2013 5 / 25
  • 7. I- Introduction Saber F. (TIMA SLS ) ENSI 18 Avril 2013 6 / 25
  • 8. Qemu Overview Generic and open source machine emulator and virtualizer, Created by Fabrice Bellard in 2003, uses portable dynamic translation, Supported Targets : x86, arm, mips, sh4, cris, sparc, powerpc, nds32... Qemu Features Just-in-time (JIT) compilation support, Self-modifying code support, Direct block chaining. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 7 / 25
  • 9. Subject Problematic Simulation speed is mainly affected by reuse of TB, Current policy just flush the entire cache when it is full, We need to enhance translation cache policy in order to maximize TB reuse. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 8 / 25
  • 10. II- Cache Algorithms Saber F. (TIMA SLS ) ENSI 18 Avril 2013 9 / 25
  • 11. Optimal cache algorithm Evict entry that will not be used for the longest time. Unfeasible in practice, since we cannot really know future ! Saber F. (TIMA SLS ) ENSI 18 Avril 2013 10 / 25
  • 12. Optimal cache algorithm Evict entry that will not be used for the longest time. Unfeasible in practice, since we cannot really know future ! First In First Out Most simple cache replacement policy, Entry remain in memory a constant duration. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 10 / 25
  • 13. Optimal cache algorithm Evict entry that will not be used for the longest time. Unfeasible in practice, since we cannot really know future ! First In First Out Most simple cache replacement policy, Entry remain in memory a constant duration. Least Recently Used Enhancement to FIFO. Each time an entry is referenced, it is moved to the end of the queue. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 10 / 25
  • 14. Optimal cache algorithm Evict entry that will not be used for the longest time. Unfeasible in practice, since we cannot really know future ! First In First Out Most simple cache replacement policy, Entry remain in memory a constant duration. Least Recently Used Enhancement to FIFO. Each time an entry is referenced, it is moved to the end of the queue. Least Frequently Used Exploit the overall popularity rather than temporal locality. Least referenced entry is always chosen for eviction. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 10 / 25
  • 15. III- Qemu internals Saber F. (TIMA SLS ) ENSI 18 Avril 2013 11 / 25
  • 16. Dynamic Binary Translation in Qemu Saber F. (TIMA SLS ) ENSI 18 Avril 2013 12 / 25
  • 17. Dynamic Binary Translation in Qemu Saber F. (TIMA SLS ) ENSI 18 Avril 2013 12 / 25
  • 18. Dynamic Binary Translation in Qemu Saber F. (TIMA SLS ) ENSI 18 Avril 2013 12 / 25
  • 19. Bloc chaining Saber F. (TIMA SLS ) ENSI 18 Avril 2013 13 / 25
  • 20. Bloc chaining Saber F. (TIMA SLS ) ENSI 18 Avril 2013 13 / 25
  • 21. lookup tb by target pc no Translate one basic block Cached ? yes execute tb chain it to existed basic block Exception handling Saber F. (TIMA SLS ) ENSI 18 Avril 2013 14 / 25
  • 22. lookup tb by target pc no Translate one basic block Cached ? yes execute tb chain it to existed basic block Exception handling Saber F. (TIMA SLS ) ENSI 18 Avril 2013 15 / 25
  • 23. Focus on (Translate one basic block) try to allocate space for tb sucess ? no Flush entire translation cache yes allocate space for tb (cannot fail!) generate op & host code Saber F. (TIMA SLS ) ENSI 18 Avril 2013 16 / 25
  • 24. Implementation constraints Variable TB size In basics cache algorithms, evicting one entry is always sufficient to bring an other, but in our case, TB size is not only variable, but also unknown during allocation. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 17 / 25
  • 25. Implementation constraints Variable TB size In basics cache algorithms, evicting one entry is always sufficient to bring an other, but in our case, TB size is not only variable, but also unknown during allocation. Self modifying code When the executed code modify it self, the TB is re-translated into different space. thus result in many memory allocation while only the last one is needed. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 17 / 25
  • 26. Implementation constraints Variable TB size In basics cache algorithms, evicting one entry is always sufficient to bring an other, but in our case, TB size is not only variable, but also unknown during allocation. Self modifying code When the executed code modify it self, the TB is re-translated into different space. thus result in many memory allocation while only the last one is needed. Low overhead We need to predict if the the replacement cache overhead remain below the cost of cache flush, otherwise, we should simply flush the entire cache. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 17 / 25
  • 27. IV- Preliminary Results Saber F. (TIMA SLS ) ENSI 18 Avril 2013 18 / 25
  • 28. Goals Simulate LRU & LFU Algorithms, Compare cache hit ratio, Evaluate overhead of each algorithm. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 19 / 25
  • 29. Goals Simulate LRU & LFU Algorithms, Compare cache hit ratio, Evaluate overhead of each algorithm. Assumptions We ignore TB size & cache size, Quota of retained entries is 1/5, Cache size is just limited by number of TB, Saber F. (TIMA SLS ) ENSI 18 Avril 2013 19 / 25
  • 30. Execution ratio = (executions/translation) Saber F. (TIMA SLS ) ENSI 18 Avril 2013 20 / 25
  • 31. LFU cache hit ratio Saber F. (TIMA SLS ) ENSI 18 Avril 2013 21 / 25
  • 32. LRU cache hit ratio Saber F. (TIMA SLS ) ENSI 18 Avril 2013 22 / 25
  • 33. Perspectives find a suitable cache replacement policy that take care of implementation constraints. use a dynamically variable quota for retained entries. add small op-code buffer to optimize re-translation of self modifying code. divide translation cache into multiple space to optimize partial cache flush. Saber F. (TIMA SLS ) ENSI 18 Avril 2013 23 / 25
  • 34. Bibliography QEMU Just-In-Time Code Generator and System Emulation - cmchao (March 15,2010). QEMU internals - Chad D. Kersey (January 28, 2009). QEMU, a Fast and Portable Dynamic Translator - Fabrice Bellard (USENIX 2005 Annual). Performance Evaluation of Traditional Caching Policies on A Large System with Petabytes of Data - 2012 IEEE Seventh International Conference on Networking, Architecture, and Storage Saber F. (TIMA SLS ) ENSI 18 Avril 2013 24 / 25
  • 35. Thanks for your attention ! Feel free to ask any question ! Saber F. (TIMA SLS ) ENSI 18 Avril 2013 25 / 25