Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Android Runtime

From Wikipedia, the free encyclopedia
Runtime environment used by Android

ART
DeveloperGoogle
Written inC++
Operating systemAndroid
PlatformARM64RISC-Vx86
Included withAndroid
PredecessorDalvik
TypeRuntime environment
LicenseApache License 2.0[1]
Websitesource.android.com/docs/core/runtime Edit this on Wikidata
Repositoryandroid.googlesource.com/platform/art/
Program execution
General concepts
Types of code
Compilation strategies
Notable runtimes
Notable compilers & toolchains

Android Runtime (ART) is an applicationruntime environment used by theAndroidoperating system. ReplacingDalvik, theprocess virtual machine originally used by Android, ART performs thetranslation of some of the application'sbytecode intonative instructions that are later executed by the device's runtime environment.[2]

Overview

[edit]
A comparison of Dalvik and ART architectures

Android 2.2 "Froyo" broughttrace-based just-in-time (JIT) compilation into Dalvik, optimizing the execution of applications by continuallyprofiling applications each time they run and dynamicallycompiling frequently executed short segments of their bytecode into nativemachine code. While Dalvikinterprets the rest of an application's bytecode, native execution of those short bytecode segments, called "traces", provides significant performance improvements.[3][4]

Unlike Dalvik, ART introduces the use ofahead-of-time (AOT) compilation by compiling the most performance-critical parts of applications (previously, the entire app) into native machine code upon their installation. This way, ART improves the overall execution efficiency and reduces power consumption, which results in improved battery autonomy onmobile devices. At the same time, ART brings faster execution of applications, improvedmemory allocation andgarbage collection (GC) mechanisms, new applicationsdebugging features, and more accurate high-level profiling of applications.[2][5][6]

To maintainbackward compatibility, ART uses the same input bytecode as Dalvik, supplied through standard.dex files as part ofAPK files, while the.odex files are replaced withExecutable and Linkable Format (ELF) executables. Once an application is compiled by using ART's on-devicedex2oat utility, it is run from the compiled ELF executable; as a result, ART eliminates various application execution overheads associated with Dalvik's interpretation and trace-based JIT compilation.

A disadvantage of ART is that additional time is required for compilation when an application is installed, and applications take up slightly moresecondary storage (usuallyflash memory) to store the compiled code.[2][5][6] Long AOT compilation became especially problematic when monthly security updates became the norm, locking users out of the OS for a long time after each update.

To improve on these, a hybrid approach was introduced in Android 7.0 (Nougat) which originally relies on JIT compilation, but later, when the device is idle and charging, compiles the most frequently used code as well as that on the UI thread to native code.[7]

History

[edit]

Android 4.4 "KitKat" introduced atechnology preview of ART as an alternative runtime environment to Dalvik, which remained the default virtual machine.[8][9] In the subsequent major Android release,Android 5.0 "Lollipop", Dalvik was entirely replaced by ART.

Android 7.0 "Nougat" turned the ART from a pure AOT to a hybrid JIT/AOT solution, while switching itsJava Runtime Environment from the discontinuedApache Harmony toOpenJDK, introducing a JIT compiler with code profiling.[10] The JIT compiler complements ART's AOT compiler, helping to improve runtime performance and save storage space by identifying "hot code" (code which is frequently used, runs on the UI thread or affects startup time), which the AOT compiler compiles to machine code while the device is idle and charging. Less-frequently used code relies on JIT compilation.[11][12]

Android 9 "Pie" reduced the amount of storage used byAPKs by using compressedbytecode files, andprofiler data can be uploaded toGoogle Play servers to be bundled with apps when downloaded by users with a similar device, which shortens download time from Google Play by up to 40%. Google Play cloud profiles allow apps to be optimized on installation, which helps avoid the initial performance issues present on Android 7.0 to 8.1.[13]

In July 2021,[14] the concept of baseline profiles was introduced. Baseline profiles are ART profiles that define methods and classes which should undergo AOT compilation from an app's first launch, and are compatible with Android 7.0 and later. They provide similar functionality to Android 9's Google Play cloud profiles when they are not available and automatically merge with cloud profiles when they are available. Baseline profiles are included with releases of AndroidX libraries andJetpack Compose.[15]

ART was updated with a newgarbage collector (GC) utilizing theLinux userfaultfdsystem call inAndroid 13.[16][17][18] It reduces memory pressure, compiled code size andjank, and prevents the risk of killing apps because of low memory duringgarbage collection.[18] Other changes also improve app startup, reduce jank and improve performance.[18] Because of the Mainline project,Android 12's ART will also be updated.[16]

See also

[edit]

References

[edit]
  1. ^"NOTICE - platform/art - Git at Google".Archived from the original on March 4, 2023. RetrievedJune 25, 2021.
  2. ^abcAndrei Frumusanu (July 1, 2014)."A Closer Look at Android RunTime (ART) in Android L".AnandTech. Archived fromthe original on July 5, 2014. RetrievedJuly 5, 2014.
  3. ^Ben Cheng; Bill Buzbee (May 2010)."A JIT Compiler for Android's Dalvik VM"(PDF).android-app-developer.co.uk.Google. pp. 5–14. Archived fromthe original(PDF) on November 6, 2015. RetrievedMarch 18, 2015.
  4. ^Phil Nickinson (May 26, 2010)."Google Android developer explains more about Dalvik and the JIT in Froyo".androidcentral.com.Archived from the original on April 8, 2017. RetrievedJuly 8, 2014.
  5. ^ab"Android Developers: ART and Dalvik".source.android.com. March 9, 2015.Archived from the original on March 15, 2015. RetrievedMarch 18, 2015.
  6. ^ab"Android Developers: Configuring ART – How ART works".source.android.com. March 9, 2015. RetrievedMarch 18, 2015.
  7. ^Amadeo, Ron (August 22, 2016)."Android 7.0 Nougat review—Do more on your gigantic smartphone".Ars Technica. RetrievedApril 5, 2023.
  8. ^Sean Buckley (November 6, 2013)."'ART' experiment in Android KitKat improves battery life and speeds up apps".Engadget.Archived from the original on January 27, 2017. RetrievedJuly 5, 2014.
  9. ^Daniel P. (November 7, 2013)."Experimental Google ART runtime in Android KitKat can bring twice faster app executions".phonearena.com.Archived from the original on July 7, 2014. RetrievedJuly 5, 2014.
  10. ^"Android 7.0 for Developers".Android Developers. RetrievedMarch 22, 2021.
  11. ^Amadeo, Ron (August 22, 2016)."Android 7.0 Nougat review—Do more on your gigantic smartphone".Ars Technica. RetrievedApril 5, 2023.
  12. ^"Implementing ART Just-In-Time (JIT) Compiler".source.android.com. January 22, 2017.Archived from the original on August 8, 2023. RetrievedJanuary 22, 2017.
  13. ^Amadeo, Ron (September 13, 2018)."Android 9 Pie, thoroughly reviewed".Ars Technica.Archived from the original on November 30, 2018. RetrievedAugust 16, 2022.
  14. ^"ProfileInstaller | Jetpack".Android Developers.Archived from the original on August 8, 2023. RetrievedJuly 5, 2023.
  15. ^Semenova, Kateryna; Ravikumar, Rahul; Craik, Chris (January 28, 2022)."Improving App Performance with Baseline Profiles".Android Developers Blog.Archived from the original on August 8, 2023. RetrievedJuly 5, 2023.
  16. ^abGidra, Lokesh (May 12, 2022),What's new in app performance,archived from the original on August 16, 2022, retrievedAugust 16, 2022
  17. ^Gidra, Lokesh; Boehm, Hans-J.; Fernandes, Joel (October 12, 2020)."Utilizing the Linux Userfaultfd System Call in a Compaction Phase of a Garbage Collection Process".Defensive Publications Series.Archived from the original on August 16, 2022. RetrievedAugust 16, 2022.
  18. ^abc"Android 13 is in AOSP!".Android Developers Blog.Archived from the original on August 15, 2022. RetrievedAugust 16, 2022.

External links

[edit]
Wikimedia Commons has media related toAndroid Runtime.
Software
development
Development tools
Official
Other
Integrated development
environments
(IDE)
Languages,databases
Augmented reality andvirtual reality
Events,communities
Releases
Derivatives
Devices
Pixel
Nexus
Play edition
Custom
distributions
Booting and
recovery
APIs
AlternativeUIs
Rooting
Lists
Related topics
Sun,Oracle
Major implementations
Embedded
Others
Discontinued
Retrieved from "https://en.wikipedia.org/w/index.php?title=Android_Runtime&oldid=1325705497"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp