Asleep from Day

September 28, 2008

How Dalvik launches Android app

Filed under: Android — John @ 7:27 am

This is just a guess, but I think the way Dalvik, the JVM of Android, launches an app is similar to the processing launcher I wrote for Openmoko. It starts a service on dbus, then load and run the processing apps by request. This can make the start up time much shorter because basically it runs in the same jvm instance. Something like this:

fork()
if (child) {
    load the app java class
    run it
}
/* I'm parent */
wait and check if it's okay

So, during system start up, the first instance of Dalvik is created, and all the common java classes are loaded because you need to start the ‘home’ application. Now whenever you fork a new process, the linux kernel will try to be smart and only copy memory pages if the child process modified something in it. (copy on write)

Anyway, we will see after the release of Android source code.

2008/09/30:
So, it turns out I’m right. According to Anatomy & Physiology of an Android, that first instance is called ‘zygote’. Quite self-explaining.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.