Arpit Jain Mtech1. Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

An Overview Of Virtual Machine Architectures Ross Rosemark.
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.
Introduction.  Professor  Adam Porter 
Instruction Set Design
Android architecture overview
Mobile Handset Virtual Machine. Outline Virtual Machine Java Virtual Machine Dalvik Virtual Machine 2.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
JETT 2003 Java.compareTo(C++). JAVA Java Platform consists of 4 parts: –Java Language –Java API –Java class format –Java Virtual Machine.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
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.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
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.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Introduction to Android Platform Overview
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.
Android Introduction Based on slides made by
CSC 8505 Compiler Construction IR Example: Java Bytecode (looking inside class files)
Authors: William Enck The Pennsylvania State University Peter Gilbert Duke University Byung-Gon Chun Intel Labs Landon P. Cox Duke University Jaeyeon Jung.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
How Java Programs Work MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
Java Virtual Machine Java Virtual Machine A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
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
CSC 310 – Imperative Programming Languages, Spring, 2009 Virtual Machines and Threaded Intermediate Code (instead of PR Chapter 5 on Target Machine Architecture)
Introduction to the Java Virtual Machine 井民全. JVM (Java Virtual Machine) the environment in which the java programs execute The specification define an.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Roopa.T PESIT, Bangalore. Source and Credits Dalvik VM, Dan Bornstein Google IO 2008 The Dalvik virtual machine Architecture by David Ehringer.
CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina.
Java Virtual Machine Case Study on the Design of JikesRVM.
Conrad Benham Java Opcode and Runtime Data Analysis By: Conrad Benham Supervisor: Professor Arthur Sale.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
Created By. Jainik B Patel Prashant A Goswami Gujarat Vidyapith Computer Department Ahmedabad.
More on MIPS programs n SPIM does not support everything supported by a general MIPS assembler. For example, –.end doesn’t work Use j $ra –.macro doesn’t.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
By Adam Reimel. Outline Introduction Platform Architecture Future Conclusion.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
RealTimeSystems Lab Jong-Koo, Lim
ANDROID OS Ravi Soni MTech (CS) III Sem. W HAT IS A NDROID ? Android is a software stack for mobile devices that includes an operating system, middleware.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Presented by: Saurabh Kumar Sinha (MRT07UGBIT 186) IT VII Semester, Shobhit University Meerut.
Computer System Structures
Android Mobile Application Development
Visit for more Learning Resources
Before You Begin Nahla Abuel-ola /WIT.
Chapter 2: Operating-System Structures
A Closer Look at Instruction Set Architectures
Lecture 1: Introduction to JAVA
Topic: Difference b/w JDK, JRE, JIT, JVM
CASE STUDY 1: Linux and Android
Introduction Enosis Learning.
CMPE419 Mobile Application Development
Mobile Handset Virtual Machine
Introduction Enosis Learning.
CSc 453 Interpreters & Interpretation
Introduction CSC 111.
(Computer fundamental Lab)
Android Introduction Platform Mihail L. Sichitiu.
Android Platform, Android App Basic Components
CMPE419 Mobile Application Development
M S COLLEGE ART’S, COMM., SCI. & BMS
Presentation transcript:

Arpit Jain Mtech1

Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation

Virtual Machine Virtual machines (VMs) are commonly used to distribute programs in an architecture-neutral format, which can easily be interpreted or compiled.

Android OS Android OS is a software stack consisting of java app running on a java app framework on top of java core library running on dalvik VM. Android uses dalvik virtual machine. Compile java code to dalvik executables and that is run on dalvik VM.

Android Framework

Dalvik VM Dalvik is the virtual machine (VM) in Google's Android operating system. It is the software that runs the apps on Android devices. Programs are commonly written in Java and compiled to byte code. They are then converted from Java Virtual Machine-compatible.class files to Dalvik- compatible.dex (Dalvik Executable) files before installation on a device

Dalvik VM Provides application portability. Runs optimised file format(.dex) and dalvik byte code. Minimal memory footprint.

DEX format A tool called dx is used to convert some (but not all) Java.class files into the.dex format. Multiple classes are included in a single.dex file. Duplicate strings and other constants used in multiple class files are included only once in the.dex output to conserve space. An uncompressed.dex file is typically a few percent smaller in size than a compressed.jar (Java Archive) derived from the same.class files.

Dex file On the Android platform, Java source code is still compiled into.class files. But after.class files are generated, the “dx” tool is used to convert the.class files into a.dex, or Dalvik Executable, file. Whereas a.class file contains only one class, a.dex file contains multiple classes. It is the.dex file that is executed on the Dalvik VM. The.dex file has been optimized for memory usage.

Zygote Since every application runs in its own instance of the VM, VM instances must be able to start quickly when a new application is launched and the memory footprint of the VM must be minimal. Android uses a concept called the Zygote to enable both sharing of code across VM instances and to provide fast start up time of new VM instances.

Java VM A Java virtual machine (JVM) is a virtual machine that can execute Java bytecode. It is the code execution component of the Java software platform. A JVM is distributed along with a set of standard class libraries that implement the Java application programming interface (API). Appropriate APIs bundled together with JVM form the Java Runtime Environment. Java has always been marketed as “write once, run anywhere.”

Java VM In standard Java environments, Java source code is compiled into Java bytecode, which is stored within.class files. The.class files are read by the JVM at runtime. Each class in your Java code will result in one.class file. This means that if you have, say, one.java source file that contains one public class, one static inner class, and three anonymous classes, the compilation process (javac) will output 5.class files.

Comparisons Dalvik VMJava VM Register BasedStack Based Executes.dex fileExecutes.class file It uses shared, type-specific constant pools as it’s primary mechanism for conserving memory. Rather than store these values throughout the class, they are always referred to by their index in the constant pool. In the case of the.class file, each class has its own private, heterogeneous constant pool.

Disadvantages of Dex By allowing for classes to share constants pools, repetition of constant values is kept to a minimum. The consequence of the minimal repetition is that there are significantly more logical pointers or references within a.dex file compared to a.class file. Simplicity of JVM implementation, ease of writing a compiler back-end

STACK VERSUS REGISTERS The cost of executing a VM instruction in an interpreter consists of three components: Dispatching the instruction Accessing the operands Performing the computation

Dispatching instruction It involves fetching next VM instruction and jump to the corresponding segment of interpreter code. Example: A=B+C can be ILOAD c, ILOAD b, IADD, ISTORE a(stack JVM) IADD a, b, c (virtual register Machine)

Operands Accessing Location of operands appears explicit in register code, while in stack based operands are found relative to stack pointer. So, average register instruction is longer than the corresponding stack instruction. This is the reason why stack architecture is popular.

Translating Stack to Register In stack based JVM, local variable is accessed using an index, and the operands stack is accessed using stack pointer. So all variables are short lived. While Register based JVM considers both local variables and operand stack as virtual register.

Contd...

Translating Stack to Register So, most of the stack-based JVM instructions are translated to corresponding register based virtual machine instruction with implicit operands translated to explicit operand registers. Example:

Copy propagation In stack based JVM, operands are pushed from local variables to operand stack before they can be used and result again back to local variable. This causes redundancy in our register based JVM as instructions can directly use local variables without going through the stack. So we use forward and backward copy propagation to eliminate redundancy.

Example Instruction after translation for register based JVM After forward and backward copy propagation

Experimental Evaluation Studies shows that a register-based architecture requires and average of 47% less executed VM instructions than the stack based. 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.

Contd...

References [1] Virtual Machine Showdown: Stack Versus Registers by Yunhe Shi, David Gregg, Andrew Beatty Department of Computer Science University of Dublin, Trinity College Dublin 2, Ireland [2] J. Park and S. mook Moon. Optimistic register coalescing, Mar [3] The dalvik virtual machine architecture by David Ehringer.