written 7.9 years ago by | • modified 7.9 years ago |
Mumbai University > Information Technology > Sem 5 > Open Source Technology
Marks: 5M
Year: Dec 2015
written 7.9 years ago by | • modified 7.9 years ago |
Mumbai University > Information Technology > Sem 5 > Open Source Technology
Marks: 5M
Year: Dec 2015
written 7.9 years ago by |
One of the most important tasks in the system is initializing the user-space environment once the kernel has finished initializing device drivers and its own internal structures.
In a typical Linux system, init’s role would be limited to starting daemons, but, if only because of its property service, Android’s init is special. Like any Linux init, however, Android’s init isn’t expected to ever die. init is, the first process started by the kernel and, as such, its PID is always 1. Should it ever die, the kernel would panic.
init includes an implementation of the udev hotplug events handler. Because this code is compiled within init’s own code, init checks the command-line that was used to invoke it, and if it was invoked through the /sbin/ueventd symbolic link to /init, then init immediately runs as ueventd.
The next thing init does is create and mount /dev, /proc, and /sys. These directories and their entries are crucial to many of the things init does next. init then reads the /init.rc and /init..rc files, parses their content into its internal structures, and proceeds to initialize the system based on a mix of its configuration files and built-in rules.
Once all initialization is done, init then enters an infinite loop in which it restarts any services that might have exited and that need restarting, and then polls file descriptors it handles, such as the property service’s socket, for any input that needs to be processed. This is how setprop property setting requests are serviced.