13

I am trying to figure out the specific differences in the Dalvik and ART runtimes. I realize that ART no longer uses the Dalvik VM, however, one of the first things I noticed after installing the Android L preview was that the zygote process is still running. If they truly got rid of the Dalvik VM, wouldn't that render the zygote process useless? Furthermore, upon inspecting the source code released via AOSP, a large portion of Dalvik still remains.

John
  • 131
  • 1
  • 1
  • 3

1 Answers1

15

Zygote isn't really bound up with Dalvik, it's just an init process. Zygote is the method Android uses to start apps. Rather than having to start each new process from scratch, loading the whole system and the Android framework afresh each time you want to start an app, it does that process once, and then stops at that point, before Zygote has done anything app-specific. Then, when you want to start an app, the Zygote process forks, and the child process continues where it left off, loading the app itself into the VM.

Although this method was originally designed for Dalvik, there's no reason ART shouldn't behave exactly the same way. It doesn't have to JIT-compile apps while they're running, but it still has a lot of app-independent Java stuff to load (i.e. the whole Android framework), so it makes sense to use the same fork-when-loaded method to start new processes.

It's natural on such a large project that there would be other left-overs from Dalvik that are still useful in a post-Dalvik world, so you shouldn't be surprised that there is other code that was originally written to be part of or to work with Dalvik, that is still around for ART to use.

Dan Hulme
  • 35,070
  • 17
  • 92
  • 158