When Linux/Unix starts up, one-or-more entries are "manually created" in the process table. Implementations vary (Unix, Linux, OS/X...), but the essential idea is the same: a certain number of user-land processes "appear, as if by magic" (well, it
is "magic"...), and they (are
required to...) exist for as long as the computer itself is "up."
(In Linux, if "process #1,"
a.k.a. init, ever dies, for any reason, you immediately get the slightly-incorrect kernel panic, "attempted to kill
init." Well, nobody
killed it,
per se, but "it is not allowed to die.")
Now... "why would we ever want to do such a thing?" The answer, actually, is
elegance, but the reasons might not be entirely obvious unless you have spent some time designing operating systems.
If you
haven't, (and I shall presume that you have not...) then let me just say that "kernel-space code is in rather an awkward spot." The kernel's job is to
create the environment in which "user space" code runs, but because of that very-special status, it can never
live "in userland." And, in a general sense, it can never
trust anyone who "lives there." (No, not even the processes that happen to be running as
root!)
Well... to make a very long story very short, "these
very-special userland processes"
are trusted. They are "trusted," in fact, to a degree that
no other user-land process is ...
bar none. They perform roles that are absolutely as much "part of 'the kernel'" as "the kernel itself" is, except for the fact that they are
not, by definition, part of the kernel.
The role of
init, the "'process #1' of any Linux system," can be succintly defined as follows:
- If any process 'dies' when its parent has already died, "init" will reap it.
- All 'daemon' processes are spawned by init at system startup, and if any of those processes subsequently die, init alone decides "what to do."
Is that "role" ... like ...
huge? Uh huh, yes it is. To the degree that "Linux cannot
survive without it." To the degree that, "Linux must (and will...) 'roll over and die immediately' if nobody in user-land can fill that role."
Some Unix-derivative systems, like Apple's OS/X (Darwin...) define more-than-one process to act in these
uber-privileged roles. Any way that you slice it, "it is an utterly amazing, utterly elegant hack" that has survived since the 1970's ... when it was the death-knell to the utterly over-engineered Multics system.