Android Startup And Zygote


Power on and system startup

When we switch on our android mobile, Boot ROM code starts its execution from a pre-specified location which is hardwired on Reading Only Memory. It loads Bootloader into Random Access Memory and starts execution.

Bootloader

The bootloader is one type of small program. An Android operating system run after bootloader process. The bootloader is the first process to run. There are many popular bootloaders are available. The manufacturer can use readymade bootloaders like redboot, uboot etc or they can develop own bootloaders. The bootloader is not a part of an android operating system.

There are two stages of bootloader,

  1. Bootloader detects external Random Access Memory (RAM) and loads a program which will be helpful in the second stage.
  2. Bootloader setup network, memory etc. which requires running kernel.

Location of bootloader : <Android Source>\bootable\bootloader\legacy\usbloader

Kernal

Linux kernel starting process and android kernel starting the process are similar. This process will setup cache, protected memory, scheduling, and loads drivers. When kernel completed the system setup it looks for “init” in the system files and launches startup process or first process of the system.

Init process

This is the first process, or in other words, it is a boss of all processes. There is two responsibility of init process.

  1. mount directories like /sys, /dev, /proc
  2. run init.rc script.

Location of init process: <android source>/system/core/init

Location of init.rc file: <android source>/system/core/rootdir/init.rc

Zygote and Dalvik Virtual Machine

We know that in java there is Java Virtual Machine (JVM), but in the android virtual machine must be run as fast as possible. Suppose you have three apps running simultaneously, and it needs three Dalvik virtual machines, but it consumes lots of memory and time. As a solution to this problem, android has a facility named Zygote. The Zygote enables code sharing across the Dalvik Virtual Machine. The zygote is a process wich starts at the time of system boot. Zygote preloads and initializes core library classes.

Zygote loading process:

  1. Load ZygoteInit class,
  2. registerZygoteSocket() – It registers a server socket for zygote command connections.
  3. preloadClasses() – Is a simple text file that contains a list of classes that need to be preloaded, you can find the file at <android source>/framework/base
  4. preloadResources() – Everything that is included in the android.R file will be loaded with this method (themes and layouts).

At this time, boot animation will be displayed.

System Services

  1. Starting Power Manager
  2. Creating Activity Manager
  3. Starting Telephony Registry
  4. Starting Package Manager
  5. Set Activity Manager Service as System Process
  6. Starting Context Manager
  7. Starting System Context Providers
  8. Starting Battery Service
  9. Starting Alarm Manager
  10. Starting Sensor Service
  11. Starting Window Manager
  12. Starting Bluetooth Service
  13. Starting Mount Service

Other Services:

  1. Starting Status Bar Service
  2. Starting Hardware Service
  3. Starting NetStat Service
  4. Starting Connectivity Service
  5. Starting Notification Manager
  6. Starting DeviceStorageMonitor Service
  7. Starting Location Manager
  8. Starting Search Service
  9. Starting Clipboard Service
  10. Starting Checkin Service
  11. Starting Wallpaper Service
  12. Starting Audio Service
  13. Starting HeadsetObserver
  14. Starting AdbSettingsObserver

Boot Completed!

When all system services running in memory, android has completed the booting process.

What is your reaction?

0
Excited
0
Happy
0
In Love
3
Not Sure
0
Silly
Carolyn Jenner

You may also like

Comments

  1. Visitor Rating: 3 Stars

Comments are closed.