Roopa.T PESIT, Bangalore. Source and Credits Dalvik VM, Dan Bornstein Google IO 2008 The Dalvik virtual machine Architecture by David Ehringer.

Slides:



Advertisements
Similar presentations
An Overview Of Virtual Machine Architectures Ross Rosemark.
Advertisements

Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Virtual Machines Matthew Dwyer 324E Nichols Hall
Introduction.  Professor  Adam Porter 
1 Lecture 10 Intermediate Representations. 2 front end »produces an intermediate representation (IR) for the program. optimizer »transforms the code in.
CPU Review and Programming Models CT101 – Computing Systems.
Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
Android architecture overview
1 1 Lecture 14 Java Virtual Machine Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Mobile Handset Virtual Machine. Outline Virtual Machine Java Virtual Machine Dalvik Virtual Machine 2.
DEPARTMENT OF COMPUTER ENGINEERING
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
Consider With x = 10 we may proceed as (10-1) = 9 (10-7) = 3 (9*3) = 27 (10-11) = -1 27/(-1) = -27 Writing intermediates on paper.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
Intro to Java The Java Virtual Machine. What is the JVM  a software emulation of a hypothetical computing machine that runs Java bytecodes (Java compiler.
Android Introduction Platform Overview.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Computer Organization
Part 1.  Intel x86/Pentium family  32-bit CISC processor  SUN SPARC and UltraSPARC  32- and 64-bit RISC processors  Java  C  C++  Java  Why Java?
Compiler Construction Lecture 17 Mapping Variables to Memory.
Android Introduction Based on slides made by
Arpit Jain Mtech1. Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
Specification and Design of Quasi- Delay-Insensitive Java Card Microprocessor Fu-Chiung Cheng & Chuin-Ren Wang Dept. of Computer Science and Engineering.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
Lecture 10 : Introduction to Java Virtual Machine
Introduction to the Java Virtual Machine 井民全. JVM (Java Virtual Machine) the environment in which the java programs execute The specification define an.
An Efficient Stack Machine Martin Schöberl. JOP Stack Architecture2 Overview JVM stack machine Parameter passing Stack access patterns Common stack caches.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
Part 1.  Intel x86/Pentium family  32-bit CISC processor  SUN SPARC and UltraSPARC  32- and 64-bit RISC processors  Java  C  C++  Java  Why Java?
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
ECEG-3202 Computer Architecture and Organization Chapter 7 Reduced Instruction Set Computers.
By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual.
Programming in the Context of a Typical Computer Computer Studies Created by Rex Woollard.
Memory Management Chapter 5 Advanced Operating System.
By Adam Reimel. Outline Introduction Platform Architecture Future Conclusion.
RealTimeSystems Lab Jong-Koo, Lim
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Computer System Structures
Android Mobile Application Development
Chapter 2: Operating-System Structures
A Closer Look at Instruction Set Architectures
Topic: Difference b/w JDK, JRE, JIT, JVM
CASE STUDY 1: Linux and Android
Java package classes Java package classes.
Architecture Background
Introduction Enosis Learning.
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Mobile Handset Virtual Machine
OS Virtualization.
Introduction Enosis Learning.
Java Byte Codes (0xCAFEBABE) cs205: engineering software
Central Processing Unit
CSc 453 Interpreters & Interpretation
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS
Lecture Topics: 11/1 General Operating System Concepts Processes
Java Programming Introduction
CPU Structure CPU must:
M S COLLEGE ART’S, COMM., SCI. & BMS
Presentation transcript:

Roopa.T PESIT, Bangalore

Source and Credits Dalvik VM, Dan Bornstein Google IO 2008 The Dalvik virtual machine Architecture by David Ehringer

Big Picture

Introduction Android applications are written in Java (some applications are written partly in Java and partly native connected through JNI) The application written in Java source code gets compiled to Java class. This in turn is converted to DVM byte code by a tool called dx. The DVM byte code file has a.dex extension. The DVM loads the application classes from the dex file, executes the application similar to the way JVM does for a Java class file (albeit several key differences)

Why DVM? Goals Run on a slow CPU Limited RAM OS without swap space Battery Powered

Memory Efficiency RAM ODROID-7: 512 MB HTC Desire: 576 MB iPhone: 512 MB Available RAM gets reduced after the low level system start up and high level services Multiple independent mutually suspicious processes Separate address spaces and separate memory Large system library

Architecture Unlike JVM which is a Stack based machine, DVM is a Register based machine. Multiple classes are included in a single.dex file Duplicate strings and other constants used in multiple class files are included only once to save space. Its shown that the uncompressed.dex is much smaller than a compressed.jar file. Dalvik has been designed so that a device can run multiple instances of the VM efficiently. [ [ To address memory constraints and allow for fast startup times, Dalvik shares core, read-only libraries between VM processes. The sharing is done securely by giving the VM processes permission to read the code but not edit it

Class file format vs Dex file format

Constant pool: It stores all the literal constants used in the class like string constants, method names, class names, interface names, field names.dex uses type specific constant pools and duplication of constants is eliminated

Class file format vs Dex file format

Stack vs Register based Virtual Machine Consider an example: public int method( int i1,int i2 ) { int i3 = i1*i2; return i3*2; }

Stack based Virtual Machine Stack based machines use the stack to hold the operands, perform the operation where the result is also stored on the stack iload_1 iload_2 imul istore_3 iload_3 iconst_2 imul ireturn

Register based Virtual machine mul-int v0,v2,v3 ; v0=v2*v3 mul-int/lit-8 v0,v0,2 ; v0=v0*2 return v0

Advantage of Register based VM over Stack based VM Stack based VMs have a simple architecture and provide ease of writing of compiler back end. The JVM is stack based. One stack level can hold any type (char to float) Long and double need 2 consecutive stack levels Implementing stack based operations on a real machine requires memory access and hence stack operations are slower than register operations Register-based architecture requires and average of 47% less executed VM instructions than the stack based [architecture]. On the other hand the register code is 25% larger than the corresponding stack code but this increased cost of fetching more VM instructions due to larger code size involves only 1.07% extra real machine loads per VM instruction which is negligible. The overall performance of the register-based VM is that it takes on average 32.3% less time to execute standard benchmarks Security Engineering Research Group, Institute of Management Sciences. “Analysis of Dalvik Virtual Machine and Class Path Library 2009”

Advantage of Register based VM over Stack based VM Most CPU architectures are register based. RISC architectures support a large number of registers. The above implies that it is easier to map a virtual register based bytecode instruction to a physical machine. For example, consider mul-int v0, v2, v3 that performs: v2 * v3 and places the output on v0. this can be easily mapped to a physical register set with suitable machine instruction