We saw in Chapter 4, Configuring and Building the Kernel, how the kernel bootstrap code seeks to find a root filesystem, either initramfs or a filesystem specified by root= on the kernel command line, and then to execute a program which, by default, is /init for initramfs and /sbin/init for a regular filesystem. The init program has root privilege, and since it is the first process to run, it has a process ID (PID) of 1. If, for some reason, init cannot be started, the kernel will panic.
The init program is the ancestor of all other processes, as shown here by the pstree command running on a simple embedded Linux system:
# pstree -gn
init(1)-+-syslogd(63)
|-klogd(66)
|-dropbear(99)
`-sh(100)---pstree(109)
The job of the init program is to take control of the system and set it running. It maybe as simple as a shell command running...