What process is the parent of the init process in Linux?
Solution 1
According to ps -ef
, its parent process id is 0
.
For example:
$ ps -ef | head -4
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Mar14 ? 00:00:03 init [2]
root 2 0 0 Mar14 ? 00:00:00 [kthreadd]
root 3 2 0 Mar14 ? 00:00:17 [ksoftirqd/0]
It is conventional to say that init
has no parent and that, therefore, the PPID value of 0
is a placeholder signaling that it has no parent. Alternatively, one might claim that the kernel is the "parent" of init
and that the 0
signifies the kernel.
Solution 2
Actually, pid 0 is the kernel scheduler, therefore init's parent is the kenerl's scheduler, which operates in kernel mode. https://en.wikipedia.org/wiki/Process_identifier
There are two tasks with specially distinguished process IDs: swapper or sched has process ID 0 and is responsible for paging, and is actually part of the kernel rather than a normal user-mode process. Process ID 1 is usually the init process primarily responsible for starting and shutting down the system. Originally, process ID 1 was not specifically reserved for init by any technical measures: it simply had this ID as a natural consequence of being the first process invoked by the kernel. More recent Unix systems typically have additional kernel components visible as 'processes', in which case PID 1 is actively reserved for the init process to maintain consistency with older systems.r operates in kernel mode.
Related videos on Youtube
Novice
Updated on September 18, 2022Comments
-
Novice over 1 year
Who or Which process is the parent of INIT process? INIT is the first process which is initialized by the Kernel, kernel is not one process, So what is its parent process id value?