`
bluewave
  • 浏览: 6528 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

How the Dalvik Virtual Machine Works on Google Android

阅读更多
http://www.ctoedge.com/content/how-dalvik-virtual-machine-works-google-android

How the Dalvik Virtual Machine Works on Google Android
Mobile Computing | How-To | Sayed Hashimi, Satya Komatineni & Dave MacLean, Monday, March 8, 2010
Tags: Android, Google, smartphones

(The following is an excerpt from "Pro Android 2," published by APress)
As part of Android, Google has spent a lot of time thinking about optimizing designs for low-powered handheld devices. Handheld devices lag behind their desktop counterparts in memory and speed by eight to ten years. They also have limited power for computation; a handheld device’s total RAM might be as little as 64MB, and its available space for applications might be as little as 20MB.
The performance requirements on handsets are severe as a result, requiring handset designers to optimize everything. If you look at the list of packages in Android, you’ll see that they are full-featured and extensive. According to Google, these system libraries might use as much as 10 to 20MB, even with their optimized JVM.
These issues led Google to revisit the standard JVM implementation in many respects. (The key figure in Google’s implementation of this JVM is Dan Bornstein, who wrote the Dalvik VM—Dalvik is the name of a town in Iceland.) First, the Dalvik VM takes the generated Java class files and combines them into one or more Dalvik Executable (.dex) files. It reuses duplicate information from multiple class files, effectively reducing the space requirement (uncompressed) by half from a traditional .jar file. For example, the
.dex file of the web browser app in Android is about 200K, whereas the equivalent uncompressed .jar version is about 500K. The .dex file of the alarm clock app is about 50K, and roughly twice that size in its . jar version.
Second, Google has fine-tuned the garbage collection in the Dalvik VM, but it has chosen to omit a just-in-time (JIT) compiler, in early releases. The 2.0 codebase seem to have the necessary sources for a JIT compiler but is not enabled in the final release. It is anticipated that it will be part of future releases. The company can justify this choice because many of Android’s core libraries, including the graphics libraries, are implemented in C and C++. For example, the Java graphics APIs are actually thin wrapper classes around the native code using the Java Native Interface (JNI). Similarly, Android provides an optimized C-based native library to access the SQLite database, but this library is encapsulated in a higher-level Java API. Because most of the core code is in C and C++, Google reasoned that the impact of JIT compilation would not be significant.
Finally, the Dalvik VM uses a different kind of assembly-code generation, in which it uses registers as the primary units of data storage instead of the stack. Google is hoping to accomplish 30 percent fewer instructions as a result. We should point out that the final executable code in Android, as a result of the Dalvik VM, is based not on Java byte code but on .dex files instead. This means you cannot directly execute Java byte code; you have to start with Java class files and then convert them to linkable .dex files.
分享到:
评论

相关推荐

    The Dalvik Virtual Machine

    为了支持 Android 应用程序的运行,Google 设计并实现了达尔维克虚拟机(Dalvik Virtual Machine)。本文将深入探讨 Dalvik 虚拟机的技术架构、设计决策及其对 Java 平台的影响。 #### Java 虚拟机与移动平台的挑战...

    The_Dalvik_Virtual_Machine

    ### 达尔维克虚拟机(The Dalvik Virtual Machine) #### 引言 Java自问世以来,就一直以“一次编写,到处运行”为宣传口号。这一能力主要得益于Java平台,而该平台的核心则是Java虚拟机(JVM)。尽管在桌面(Java ...

    Android虚拟机Dalvik完整源码

    This directory contains the Dalvik virtual machine and core class library, as well as related tools, libraries, and tests. A note about the licenses and header comments ------------------------------...

    Android Developer Guide

    Dalvik virtual machine optimized for mobile devices Integrated browser based on the open source WebKit engine Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the ...

    进入 Android Dalvik 虚拟机

    进入 Android Dalvik 虚拟机,android dalvik介绍 Dalvik 虚拟机的特点——掌握 Android 程序的运行原理 Android 系统的架构采用分层思想,这样的好处是拥有减少各层之间的依赖性、便于独 立分发、容易收敛问题和...

    Android_Dalvik_VM_Internals_Google__

    在Android操作系统中,Dalvik虚拟机(Dalvik Virtual Machine,简称Dalvik VM)是其核心组件之一,它负责运行Android应用程序。Dalvik VM的设计目标是确保类型安全和引用安全,同时实现垃圾回收(mark-sweep算法),...

    Android Dalvik文件 编译方法

    Android Dalvik 文件编译方法 Android Dalvik 文件编译方法是 Android 应用程序开发过程中的一步关键步骤。 Dalvik 是 Android 操作系统中的虚拟机字节码格式,所有 Android 应用程序都需要将 Java 代码编译成 ...

    “Dalvik VM的字节码”,“Dalvik VM指令格式”

    **Android的Dalvik虚拟机(Dalvik Virtual Machine, DVM)是Android系统中运行应用程序的核心组件之一。在Android系统早期版本中,应用是以Dalvik字节码(Dalvik Bytecode)的形式存储和执行的,而DEX(Dalvik ...

    Android Dalvik虚拟机讲义

    Android Dalvik虚拟机是Android操作系统的核心组成部分,它是Google为移动设备特别设计的一种高效、轻量级的虚拟机。在Android系统中,应用程序以Dalvik可执行文件(.dex)的形式运行,这些文件是经过优化的Java字节...

    Bytecode for the Dalvik VM

    - Dalvik VM是Android系统的核心组件之一,它是Google为Android设计的轻量级、高效能的虚拟机。 - 它采用Just-In-Time (JIT) 或 Ahead-Of-Time (AOT) 编译方式,提高运行效率。 - 与Java虚拟机(JVM)不同,...

    android-dalvik.rar

    Dalvik是Google专门为Android系统设计的一种轻量级、高效的虚拟机。它基于Just-In-Time(JIT)编译,但主要采用预先编译( Ahead-Of-Time, AOT)的方式,将Java字节码转换为Dalvik字节码(.dex文件),这使得Android...

    Android Dalvik源码

    1. **Dalvik虚拟机**:Dalvik是Google为Android设计的一个专有虚拟机,其设计目标是在移动设备上高效地运行Java应用程序。与标准的Java虚拟机(JVM)不同,Dalvik执行的是优化过的.dex格式的字节码,这种格式更适合...

    Android虚拟机Dalvik(略谈Android Dalvik虚拟机)

    Dalvik虚拟机是Android操作系统的核心组件之一,由Google公司开发并用于其移动操作系统Android中。它是一种专为移动设备设计的轻量级虚拟机,旨在提高性能的同时减少资源消耗。与传统的Java虚拟机(JVM)相比,...

    Understanding the Dalvik bytecode with the Dedexer tool

    在讨论Dalvik字节码和Dedexer工具之前,首先需要了解Android平台的基础架构。Android是一个基于Linux的Java平台,这听起来可能会让人误以为Android应用完全兼容Java标准。然而,实际上并非如此。虽然Android提供给...

    深入理解Android之dalvik

    Android 5.0(Lollipop)之后,Google引入了ART(Android RunTime),它取代了Dalvik。ART使用AOT编译,使得应用在安装时就完成预编译,从而提供更快的启动时间和更好的运行性能。尽管Dalvik已逐渐淡出视线,但对它...

    AndBug-A Scriptable Android Debugger

    AndBug is a debugger targeting the Android platform's Dalvik virtual machine intended for reverse engineers and developers. It uses the same interfaces as Android's Eclipse debugging plugin, the Java ...

    Android Dalvik

    Android Dalvik虚拟机是Android操作系统的核心组成部分,它为Android应用程序提供了运行环境。在这个环境中,应用程序的代码被转换成Dalvik可执行格式,称为.dex(Dalvik Executable)文件,然后在此虚拟机上运行。...

    Android Framework介绍 Dalvik原理 JIT介绍

    Dalvik虚拟机(Dalvik Virtual Machine, DVM)是Android系统的核心组成部分之一,它是一种专为移动设备设计的虚拟机。与传统的Java虚拟机(JVM)相比,Dalvik具有以下特点: 1. **DEX格式**:Dalvik虚拟机使用.dex文件...

    Android编程之虚拟机Dalvik教程[PDF].rar

    Dalvik是Google为Android操作系统设计的一款轻量级的、基于寄存器架构的Java虚拟机(JVM)。与传统的JVM不同,Dalvik被优化以适应移动设备的资源限制,如内存和处理器性能。它采用了.dex(Dalvik Executable)文件...

Global site tag (gtag.js) - Google Analytics