Thursday, November 10, 2011
Android Zygote and Processes
Recently i was working on improving boot time and application launch time in android. Interestingly, what hold my attention was a neat and simple design of Android framework for maintaining, running processes and applications.
Android Start-up Sequences:
1. Boot-loader load kernel and start init process. give a look to init.rc structure here.
2. Init process spawns multiple demons e.g. android debug etc.
3. Init also start Interesting process Zygote, as name implies(very 1st step for every android process )
4. Zygote then fork to start SYSTEM PROCESS(core platform services).i.e. power manager, activity manager etc.
5. Once all system process are up, Home app display home screen and android is ready to launch very 1st app.
Zygote consist of :
1. Instance of Dalvik virtual machine with preloaded classes needed by android application app.
2. Registered socket for future request to spawn off new Dalvik virtual machine.
3. Once new request come Zygote forks itself and create new process with pre-loaded DVM.
Android application launch: