Jump to content

Android Runtime: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎top: Fits better here
Reworded the content, as discussed in Talk:Android Runtime § Description of Dalvik; Updated one and added another reference; As Android also runs on ordinary PCs, it's no longer only a mobile OS
(20 intermediate revisions by 2 users not shown)
Line 2: Line 2:
[[File:ART view.png|thumb|upright=1.8|right|A comparison of Dalvik and ART architectures]]
[[File:ART view.png|thumb|upright=1.8|right|A comparison of Dalvik and ART architectures]]


'''Android Runtime''' ('''ART''') is an application [[runtime environment]] used by the [[Android (operating system)|Android]] [[mobile operating system]]. ART replaces [[Dalvik (software)|Dalvik]], which is the [[process virtual machine]] originally used by Android, and performs transformation of the application's [[bytecode]] into [[native instruction]]s that are later executed by the device's runtime environment.<ref name="anandtech-8231">{{cite web
'''Android Runtime''' ('''ART''') is an application [[runtime environment]] used by the [[Android (operating system)|Android]] [[operating system]]. ART replaces [[Dalvik (software)|Dalvik]], which is the [[process virtual machine]] originally used by Android, and performs transformation of the application's [[bytecode]] into [[native instruction]]s that are later executed by the device's runtime environment.<ref name="anandtech-8231">{{cite web
| url = http://anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/
| url = http://anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/
| title = A Closer Look at Android RunTime (ART) in Android L
| title = A Closer Look at Android RunTime (ART) in Android L
Line 9: Line 9:
}}</ref>
}}</ref>


Unlike Dalvik, which since [[Froyo (operating system)|Android 2.2 "Froyo"]] uses [[just-in-time compilation|just-in-time (JIT) compilation]] to compile the bytecode every time an application is launched,<ref>{{cite web
[[Froyo (operating system)|Android 2.2 "Froyo"]] [[just-in-time compilation|just-in-time (JIT) compilation]] the time application ,<ref>{{cite web
| url = http://www.android-app-developer.co.uk/android-app-development-docs/android-jit-compiler-androids-dalvik-vm.pdf
| title = A JIT Compiler for Android's Dalvik VM
| date = | accessdate = {{date|--|mdy}}
| author1 = Ben Cheng | author2 = Bill Buzbee
| publisher = [[Google]] | website = android-app-developer.co.uk
| format = PDF | pages = 5&ndash;14
}}</ref><ref>{{cite web
| url = http://www.androidcentral.com/google-android-developer-explains-more-about-dalvik-and-jit-froyo
| url = http://www.androidcentral.com/google-android-developer-explains-more-about-dalvik-and-jit-froyo
| title = Google Android developer explains more about Dalvik and the JIT in Froyo
| title = Google Android developer explains more about Dalvik and the JIT in Froyo
| date = {{date|2010-05-26|mdy}} | accessdate = {{date|2014-07-08|mdy}}
| date = {{date|2010-05-26|mdy}} | accessdate = {{date|2014-07-08|mdy}}
| author = Phil Nickinson | website = androidcentral.com
| author = Phil Nickinson | website = androidcentral.com
}}</ref>
}}</ref> ART introduces use of the [[ahead-of-time compilation|ahead-of-time (AOT) compilation]] by performing it upon the installation of an application. By reducing the overall amount of compilation that needs to be performed across the operation of an application, a mobile device's processor usage is reduced and battery runtime is improved. At the same time, ART brings improvements in performance, [[Garbage collection (computer science)|garbage collection]], applications [[debugging]] and [[Profiling (computer programming)|profiling]].<ref name="anandtech-8231" /><ref name="android-source-art">{{cite web

| url = https://source.android.com/devices/tech/dalvik/art.html
ART introduces use of [[-of-time compilation|ahead-of-time (AOT) compilation]] by . By compilation , battery . At the same time, ART brings , [[Garbage collection (computer science)|garbage collection]], applications [[debugging]] and profiling.<ref name="anandtech-8231" /><ref name="android--">{{cite web
| title = Introducing ART
| url = https://source.android.com/devices/tech/dalvik/.html
| date = {{date|2014-06-12|mdy}} | accessdate = {{date|2014-07-05|mdy}}
| title = Android Developers: ART and Dalvik
| date = {{date|2015-03-09|mdy}} | accessdate = {{date|2015-03-18|mdy}}
| website = source.android.com
}}</ref><ref name="android-devs-2">{{cite web
| url = https://source.android.com/devices/tech/dalvik/configure.html#how_art_works
| title = Android Developers: Configuring ART{{snd}} How ART works
| date = {{date|2015-03-09|mdy}} | accessdate = {{date|2015-03-18|mdy}}
| website = source.android.com
| website = source.android.com
}}</ref>
}}</ref>


To maintain [[backward compatibility]], ART uses the same input bytecode as Dalvik, supplied through standard [[.dex]] files as part of [[APK (file format)|APK files]], while the [[.odex]] files are replaced with [[Executable and Linkable Format]] (ELF) executables. Once an application is compiled by using ART's on-device ''{{Mono|dex2oat}}'' utility, it is run solely from the compiled ELF executable; this approach eliminates various overheads involved with JIT compilation, but it requires additional time for compilation when an application is installed, and applications take up slightly larger amounts of space to store the compiled code.<ref name="anandtech-8231" /><ref name="android-source-art" />
To maintain [[backward compatibility]], ART uses the same input bytecode as Dalvik, supplied through standard [[.dex]] files as part of [[APK (file format)|APK files]], while the [[.odex]] files are replaced with [[Executable and Linkable Format]] (ELF) executables. Once an application is compiled by using ART's on-device ''{{Mono|dex2oat}}'' utility, it is run solely from the compiled ELF executable; this approach eliminates various overheads involved with JIT compilation, but it requires additional time for compilation when an application is installed, and applications take up slightly larger amounts of space to store the compiled code.<ref name="anandtech-8231" /><ref name="android--" />


A [[technology preview]] of ART debuted as an alternative runtime environment in [[KitKat (operating system)|Android 4.4 "KitKat"]].<ref>{{cite web
A [[technology preview]] of ART debuted as an alternative runtime environment in [[KitKat (operating system)|Android 4.4 "KitKat"]].<ref>{{cite web
Line 43: Line 57:
{{Portal|Computer programming}}
{{Portal|Computer programming}}


* [[Android software development]]
* [[Android software development]]
* [[Android version history]]
* [[Android version history]]
* [[Comparison of application virtualization software]]
* [[Comparison of application virtualization software]]
* [[Virtual machine]]{{snd}} an emulation of a particular computer system, with different degrees of implemented functionality
* [[Virtual machine]]


== References ==
== References ==
Line 54: Line 68:
* {{Official website|https://source.android.com/devices/tech/dalvik/art.html}}
* {{Official website|https://source.android.com/devices/tech/dalvik/art.html}}
* {{YouTube|id=USgXkI-NRPo|title=Android Basics 101: Understanding ART, the Android Runtime}}
* {{YouTube|id=USgXkI-NRPo|title=Android Basics 101: Understanding ART, the Android Runtime}}
* {{YouTube|id=Ls0tM-c4Vfo|title=A JIT Compiler for Android's Dalvik VM}}, Google I/O 2010, by Ben Cheng and Bill Buzbee


{{Android|state=collapsed}}
{{Android|state=collapsed}}

Revision as of 21:38, 18 March 2015

A comparison of Dalvik and ART architectures

Android Runtime (ART) is an application runtime environment used by the Android operating system. ART replaces Dalvik, which is the process virtual machine originally used by Android, and performs transformation of the application's bytecode into native instructions that are later executed by the device's runtime environment.[1]

Android 2.2 "Froyo" brought trace-based just-in-time (JIT) compilation into Dalvik, optimizing the execution of applications by continually profiling applications each time they run and dynamically compiling frequently executed short segments of their bytecode into native machine code. While Dalvik interpretes the rest of application's bytecode, native execution of those short bytecode segments, called "traces", provides significant performance improvements.[2][3]

Unlike Dalvik, ART introduces the use of ahead-of-time (AOT) compilation by compiling entire applications into native machine code upon their installation. By eliminating Dalvik's interpretation and trace-based JIT compilation, ART improves the overall execution efficiency and reduces power consumption, which results in improved battery autonomy on mobile devices. At the same time, ART brings faster execution of applications, improved garbage collection (GC) mechanisms, new applications debugging features, and more accurate high-level profiling of applications.[1][4][5]

To maintain backward compatibility, ART uses the same input bytecode as Dalvik, supplied through standard .dex files as part of APK files, while the .odex files are replaced with Executable and Linkable Format (ELF) executables. Once an application is compiled by using ART's on-device dex2oat utility, it is run solely from the compiled ELF executable; this approach eliminates various overheads involved with Dalvik's interpretation and trace-based JIT compilation, but it requires additional time for compilation when an application is installed, and applications take up slightly larger amounts of space to store the compiled code.[1][4][5]

A technology preview of ART debuted as an alternative runtime environment in Android 4.4 "KitKat".[6][7] In the next major Android release, Android 5.0 "Lollipop", Dalvik was entirely replaced by ART.[8]

See also

References

  1. ^ a b c Andrei Frumusanu (July 1, 2014). "A Closer Look at Android RunTime (ART) in Android L". AnandTech. Retrieved July 5, 2014.
  2. ^ Ben Cheng; Bill Buzbee (May 2010). "A JIT Compiler for Android's Dalvik VM" (PDF). android-app-developer.co.uk. Google. pp. 5–14. Retrieved March 18, 2015.
  3. ^ Phil Nickinson (May 26, 2010). "Google Android developer explains more about Dalvik and the JIT in Froyo". androidcentral.com. Retrieved July 8, 2014.
  4. ^ a b "Android Developers: ART and Dalvik". source.android.com. March 9, 2015. Retrieved March 18, 2015.
  5. ^ a b "Android Developers: Configuring ART – How ART works". source.android.com. March 9, 2015. Retrieved March 18, 2015.
  6. ^ Sean Buckley (November 6, 2013). "'ART' experiment in Android KitKat improves battery life and speeds up apps". Engadget. Retrieved July 5, 2014.
  7. ^ Daniel P. (November 7, 2013). "Experimental Google ART runtime in Android KitKat can bring twice faster app executions". phonearena.com. Retrieved July 5, 2014.
  8. ^ Brad Linder (October 15, 2014). "What's new in Android 5.0 Lollipop?". liliputing.com. Retrieved October 15, 2014.