- Dalvik (software)
-
Dalvik Original author(s) Dan Bornstein Operating system Linux kernel Platform Android Type Virtual machine License Apache License 2.0 Website http://code.google.com/p/dalvik/ Dalvik Executable Filename extension .dex
Dalvik is the process virtual machine (VM) in Google's Android operating system. It is the software that runs the apps on Android phones. Dalvik is thus an integral part of Android, which is typically used on mobile devices such as mobile phones, tablet computers and netbooks. Programs are commonly written in a dialect of Java and compiled to bytecode. Then they are converted from Java Virtual Machine-compatible .class files to Dalvik-compatible .dex (Dalvik Executable) files before installation on a device. The compact Dalvik Executable format is designed to be suitable 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, where some of his ancestors lived.[1][2]
Contents
Architecture
Unlike Java VMs, which are stack machines, the Dalvik VM is a register-based architecture.
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. 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 .jar (Java Archive) derived from the same .class files.[3]
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.[4]
Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate it from other standard VMs:[5]
- The VM was slimmed down to use less space
- The constant pool has been modified to use only 32-bit indicies 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.
Moreover, according to Google, Dalvik has been designed so that a device can run multiple instances of the VM efficiently.[6]
Performance
The relative merits of stack machines versus register-based approaches is a subject of ongoing debate[7].
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 with standard non graphic Java benchmarks on both Android 2.2 and Java SE embedded (both based on Java SE 6) showed that Android 2.2 was 2 to 3 times slower than Java SE embedded[8].
Class library
Dalvik does not align to Java SE nor Java ME class library profiles[9][10] (e.g., Java ME classes, AWT or Swing are not supported). Instead it uses its own library[11] built on a subset of the Apache Harmony Java implementation.
Licensing and patents
Dalvik is claimed by Google to be a clean-room implementation rather than a development on top of a standard Java runtime, which would mean it might not inherit copyright-based license restrictions from either the standard-edition or open-source-edition Java runtimes.[12]
Dalvik is published under the terms of the Apache License 2.0.[13]
On 12 August 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. In developing Android, it is alleged that Google knowingly, directly and repeatedly infringed Oracle's Java-related intellectual property.[14][15][16]
Specifically the patent infringement claim[17] references seven patents including US Patent No. 5966702 "Method And Apparatus For Preprocessing And Packaging Class Files", and US Patent No. 6910205 "Interpreting Functions Utilizing A Hybrid Of Virtual And Native Machine Instructions".[18] It also references US Patent No. RE38104 "Method And Apparatus For Resolving Data References In Generated Code".
On non-Android platforms
In 2011, the software company Myriad Group announced "Alien Dalvik", a port of the Dalvik virtual machine to platforms other than Android.[19][20]
See also
- Application virtualization
- Comparison of application virtual machines
- Comparison of Java and Android API
- Dalvik Turbo virtual machine
References
- ^ Journal entry referencing the source of the name
- ^ "Google Calling: Inside Android, the gPhone SDK". onlamp.com. http://www.onlamp.com/pub/a/onlamp/2007/11/12/google-calling-inside-the-gphone-sdk.html. Retrieved 2008-02-05.
- ^ Bornstein, Dan (2008-05-29). "Presentation of Dalvik VM Internals" (PDF). Google. p. 22. http://sites.google.com/site/io/dalvik-vm-internals/2008-05-29-Presentation-Of-Dalvik-VM-Internals.pdf?attredirects=0. Retrieved 2010-08-16.
- ^ "Nexus One Is Running Android 2.2 Froyo. How Fast Is It Compared To 2.1? Oh, Only About 450% Faster". 2010-05-13. http://www.androidpolice.com/2010/05/11/exclusive-androidpolice-coms-nexus-one-is-running-android-2-2-froyo-how-fast-is-it-compared-to-2-1-oh-only-about-450-faster/. Retrieved 2010-05-21.
- ^ Rose, John (2008-05-31). "with Android and Dalvik at Google I/O". http://blogs.sun.com/jrose/entry/with_android_and_dalvik_at. Retrieved 2008-06-08.
- ^ Google (2009-04-13). "What is Android?". http://developer.android.com/guide/basics/what-is-android.html. Retrieved 2009-04-19.
- ^ Shi, Yunhe; Gregg, David; Beatty, Andrew; Ertl, M. Anton (2005-06-11). "Virtual Machine Showdown: Stack Versus Registers". http://www.usenix.org/events/vee05/full_papers/p153-yunhe.pdf. Retrieved 2009-12-22.
- ^ Vandette, Bob (2010-11-22). "Java SE Embedded Performance Versus Android 2.2". Oracle Corporation. http://blogs.oracle.com/javaseembedded/entry/how_does_android_22s_performance_stack_up_against_java_se_embedded. Retrieved 2011-09-04. "The results show that although Androids new JIT is an improvement over its interpreter only implementation, Android is still lagging behind the performance of our Hotspot enabled Java SE Embedded. As you can see from the above results, Java SE Embedded can execute Java bytecodes from 2 to 3 times faster than Android 2.2."
- ^ "Google's Android SDK Bypasses Java ME in Favor of Java Lite and Apache Harmony". infoq.com. 2007-11-12. http://www.infoq.com/news/2007/11/android-java. Retrieved 2009-05-31. "Instead of providing a full version of the Java SE or Java ME Google has diverged on two fronts. First, a limited subset of the core Java packages is provided. (...) By going this route Android is following in the footsteps of another Google project GWT which uses Java as its development language but does not support the full JDK."
- ^ "Alternative to Point2D". Droid Tutorials. 2010-02-12. http://droidtutorials.blogspot.com/2010/02/alternative-to-point2d.html. Retrieved 2010-02-17. "Given that AWT is not supported in Android API, the Point2D class, which is useful for writing 2D graphics, is missing either."
- ^ "Package Index". Open Handset Alliance. http://developer.android.com/reference/packages.html. Retrieved 2009-.
- ^ Stefano Mazzocchi (2007-11-12). "Dalvik: how Google routed around Sun’s IP-based licensing restrictions on Java ME". http://www.betaversion.org/~stefano/linotype/news/110/. Retrieved 2010-08-16.
- ^ http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=NOTICE;hb=HEAD
- ^ "Oracle Sues Google Over Java in Android Devices". digitaltrends.com. 2010-08-13. http://www.digitaltrends.com/mobile/oracle-sues-google-over-java-in-android-devices/. Retrieved 2011-08-08.
- ^ James Niccolai (2010-08-12). "Oracle sues Google over Java use in Android". Computerworld. http://www.computerworld.com/s/article/9180678/Update_Oracle_sues_Google_over_Java_use_in_Android?taxonomyId=13. Retrieved 2010-08-13.
- ^ Mark Hachman (2010-08-13). "Oracle Sues Google Over Android Java Use". PC Magazine. Ziff Davis. http://www.pcmag.com/article2/0,2817,2367761,00.asp.
- ^ "COMPLAINT FOR PATENT AND COPYRIGHT INFRINGEMENT - DEMAND FOR JURY TRIAL". UNITED STATES DISTRICT COURT - NORTHERN DISTRICT OF CALIFORNIA. 2010-08-12. http://stadium.weblogsinc.com/engadget/files/oracle-google.pdf. Retrieved 2011-08-08. "Android (including without limitation the Dalvik VM and the Android software development kit) and devices that operate Android infringe one or more claims of each of United States Patents Nos. 6,125,447; 6,192,476; 5,966,702; 7,426,720; RE38,104; 6,910,205; and 6,061,520."
- ^ "Oracle's complaint against Google for Java patent infringement". scribd.com. http://www.scribd.com/doc/35811761/Oracle-s-complaint-against-Google-for-Java-patent-infringement. Retrieved 2010-08-13.
- ^ http://www.myriadgroup.com/Device-Manufacturers/Android-solutions/Alien-Dalvik.aspx
- ^ http://www.allaboutmeego.com/news/item/12571_Alien_Dalvik_hopes_to_bring_An.php
External links
- http://code.google.com/p/dalvik/
- Pamela Jones (August 16 2010). "Oracle America's complaint against Google, as text". Groklaw. http://www.groklaw.net/article.php?story=20100815110101756.
- Detailed Dalvik specifications documents
- Dex File Format
- Dalvik VM OpCodes
- 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
- Android-dalvik-vm-on-java is an ongoing project aims to develop a pure Java implementation of the Android's Dalvik virtual machine.
- Oracle v Google Copyright Claims Decompiled
Android Development - Android software development
- Apache Ant
- Dalvik
- Developer Challenge
- Eclipse
- Google Code
- Google App Inventor
- Google I/O
Google Nexus Aftermarket firmwares User interfaces - HTC Sense
- Motorola Motoblur
- Samsung TouchWiz
Apps Services - Android Market
- Google Search
Lists - Android related topics
- Android version history
- Android devices
- Open source Android applications
Derivative Other - Rooting
- Google Android lawn statues
Categories:- Register-based virtual machines
- Java virtual machine
- Android (operating system)
Wikimedia Foundation. 2010.