World Library  
Flag as Inappropriate
Email this Article

Dalvik (software)

Article Id: WHEBN0014217943
Reproduction Date:

Title: Dalvik (software)  
Author: World Heritage Encyclopedia
Language: English
Subject: Android (operating system), Java virtual machine, Virtual machine, Virtualization, Renderscript
Publisher: World Heritage Encyclopedia

Dalvik (software)

Original author(s) Dan Bornstein
Operating system Linux kernel
Platform Android
Type Virtual machine
License Apache License 2.0
Website .html/index/dalvik/tech/
Dalvik Executable
Filename extension .dex

Dalvik is the process virtual machine (VM) in Google's Android operating system, which, specifically, executes applications written for Android. This makes Dalvik an integral part of the Android software stack, which is typically used on mobile devices such as mobile phones and tablet computers, as well as more recently on devices such as smart TVs and wearables.

Programs are commonly written in Java and compiled to bytecode for the Java virtual machine, which is then translated to Dalvik bytecode and stored in .dex (Dalvik EXecutable) and .odex (Optimized Dalvik EXecutable) files; related terms odex and de-odex are associated with respective bytecode conversions. The compact Dalvik Executable format is designed for systems that are constrained in terms of memory and processor speed.

Dalvik is open-source software. It was originally written by Dan Bornstein, who named it after the fishing village of Dalvík in Eyjafjörður, Iceland.[1][2]

An alternative runtime environment called Android Runtime (ART) was included in Android 4.4 "KitKat" as a technology preview.[3][4] ART replaces Dalvik entirely in Android 5.0 "Lollipop".[5]


A comparison of Dalvik and ART architectures

Unlike Java VMs, which are stack machines, the Dalvik VM uses a register-based architecture that requires fewer, typically more complex virtual machine instructions. Dalvik programs are written in Java using the Android application programming interface (API), compiled to Java bytecode, and converted to Dalvik instructions as necessary.

A tool called dx is used to convert 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. Java bytecode is also converted into an alternative instruction set used by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a compressed Java archive (JAR) derived from the same .class files.[6]

The Dalvik executables may be modified again when installed onto a mobile device. In order to gain further optimizations, byte order may be swapped in certain data, simple data structures and function libraries may be linked inline, and empty class objects may be short-circuited, for example.

As of Android 2.2, Dalvik has a just-in-time compiler.[7]

Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate it from other standard VMs:[8]

  • The VM was slimmed down to use less space.
  • The constant pool has been modified to use only 32-bit indices to simplify the interpreter.
  • Standard Java bytecode executes 8-bit stack instructions. Local variables must be copied to or from the operand stack by separate instructions. Dalvik instead uses its own 16-bit instruction set that works directly on local variables. The local variable is commonly picked by a 4-bit 'virtual register' field. This lowers Dalvik's instruction count and raises its interpreter speed.

According to Google, the design of Dalvik permits a device to run multiple instances of the VM efficiently.[9]


The relative merits of stack machines versus register-based approaches are a subject of ongoing debate.[10]

Generally, stack-based machines must use instructions to load data on the stack and manipulate that data, and, thus, require more instructions than register machines to implement the same high level code, but the instructions in a register machine must encode the source and destination registers and, therefore, tend to be larger. This difference is primarily of importance to VM interpreters for which opcode dispatch tends to be expensive along with other factors similarly relevant to just-in-time compilation.

However, tests performed on ARM devices by Oracle (owner of the Java technology) in 2010 with standard non-graphical Java benchmarks on Java SE embedded seemed to show it to be faster, by 2 to 3 times, than Android 2.2 (the initial release to include a just-in-time compiler) that they compared to (both based on Java SE 6).[11]

In 2012, academic benchmarks confirmed the factor of 3 between HotSpot and Dalvik on the same Android board, also noting that Dalvik code was not smaller than Hotspot.[12]

Furthermore, benchmarks performed on Android device still show (as of March 2014) up to a factor 100 between native applications and a Dalvik application on the same Android device.[13] Upon running benchmarks using the early interpreter of 2009, both JNI and native code showed an order of magnitude speed up.[14]

Licensing and patents

Dalvik is published under the terms of the Apache License 2.0.[15] Google says that Dalvik is a clean-room implementation rather than a development on top of a standard Java runtime, which would mean it does not inherit copyright-based license restrictions from either the standard-edition or open-source-edition Java runtimes.[16] Oracle and some reviewers dispute this.[17]

On August 12, 2010, Oracle, which acquired Sun Microsystems in April 2009 and therefore owns the rights to Java, sued Google over claimed infringement of copyrights and patents. Oracle alleged that Google, in developing Android, knowingly, directly and repeatedly infringed Oracle's Java-related intellectual property.[18][19][20] In May 2012, the jury in this case found that Google did not infringe on Oracle's patents, and the trial judge ruled that the structure of the Java APIs used by Google was not copyrightable.[21][22] The parties agreed to zero dollars in statutory damages for 9 lines of copied code.[23][24]

On May 9, 2014, the Federal Circuit partially reversed the district court ruling, ruling in Oracle's favor on the copyrightability issue, and remanding the issue of fair use back to the district court.[25][26]

See also


  1. ^ Journal entry referencing the source of the name
  2. ^ "Google Calling: Inside Android, the gPhone SDK". Retrieved 2008-02-05. 
  3. ^ Sean Buckley (2013-11-06). ART' experiment in Android KitKat improves battery life and speeds up apps"'".  
  4. ^ Daniel P. (2013-11-07). "Experimental Google ART runtime in Android KitKat can bring twice faster app executions". Retrieved 2014-07-05. 
  5. ^ Brad Linder (October 15, 2014). "What's new in Android 5.0 Lollipop?". Retrieved October 15, 2014. 
  6. ^ Bornstein, Dan (2008-05-29). "Presentation of Dalvik VM Internals" (PDF). Google. p. 22. Retrieved 2010-08-16. 
  7. ^ "Nexus One Is Running Android 2.2 Froyo. How Fast Is It Compared To 2.1? Oh, Only About 450% Faster". 2010-05-13. Retrieved 2010-05-21. 
  8. ^ Rose, John (2008-05-31). "with Android and Dalvik at Google I/O". Retrieved 2008-06-08. 
  9. ^ Google (2009-04-13). "What is Android?". Retrieved 2009-04-19. 
  10. ^ Shi, Yunhe; Gregg, David; Beatty, Andrew; Ertl, M. Anton (2005-06-11). "Virtual Machine Showdown: Stack Versus Registers". Retrieved 2009-12-22. 
  11. ^ Vandette, Bob (2010-11-22). "Java SE Embedded Performance Versus Android 2.2".  
  12. ^ Hyeong-Seok Oh, Beom-Jun Kim, Hyung-Kyu Choi, Soo-Mook Moon (2012). "Evaluation of Android Dalvik virtual machine".  
  13. ^ "Top AndEBench Scores". Retrieved 2014-03-23. 
  14. ^ "Developing and Benchmarking Native Linux Applications on Android". Lecture Notes of the Institute for Computer Sciences, Social Informatics and Telecommunications Engineering.  
  15. ^ "Downloading the Source Tree - Android Open Source". Retrieved 2012-06-07. 
  16. ^ Stefano Mazzocchi (2007-11-12). "Dalvik: how Google routed around Sun’s IP-based licensing restrictions on Java ME". Retrieved 2010-08-16. 
  17. ^ Ed Bott (September 8, 2011). "The real history of Java and Android, as told by Google".  
  18. ^ "Oracle Sues Google Over Java in Android Devices". 2010-08-13. Retrieved 2011-08-08. 
  19. ^ James Niccolai (2010-08-12). "Oracle sues Google over Java use in Android".  
  20. ^ Mark Hachman (2010-08-13). "Oracle Sues Google Over Android Java Use".  
  21. ^ Josh Lowensohn (May 23, 2012). "Jury clears Google of infringing on Oracle's patents". ZDNet. Retrieved 2012-05-25. 
  22. ^ Joe Mullin (May 31, 2012). "Google wins crucial API ruling, Oracle’s case decimated". Ars Technica. Retrieved 2012-06-01. 
  23. ^ Niccolai, James (June 20, 2012). "Oracle agrees to 'zero' damages in Google lawsuit, eyes appeal". Retrieved 2012-06-23. 
  24. ^ Adam Outler (May 16, 2012). "Update on the Oracle Versus Google Trial". Retrieved 2013-01-18. A major portion of the Oracle’s claims are based on 9 lines of code contained within Java.Util.Arrays.rangeCheck(). Here is the code in question:... 
  25. ^ Rosenblatt, Seth (May 9, 2014). "Court sides with Oracle over Android in Java patent appeal". CNET. Retrieved 2014-05-10. 
  26. ^ "ORACLE AMERICA, INC. , Plaintiff - Appellant, v. GOOGLE INC., Defendant - Cross - Appellant.". Court of Appeals for the Federal Circuit. May 9, 2014. Retrieved 2014-05-10. 

External links

  • Dalvik Instruction Set – official Android documentation
  • Dex Executable Format – official Android documentation
  • Pamela Jones (August 16, 2010). "Oracle America's complaint against Google, as text".  
  • Google I/O 2010 - A JIT Compiler for Android's Dalvik VM on YouTube
  • Dalvik VM Internals – presentation from Google I/O 2008, by Dan Bornstein
  • Oracle v Google Copyright Claims Decompiled
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.