NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

System bootstrap and process with pid 0



Hello!
In this book

 <https://arxiv.org/pdf/1605.05810.pdf>

(Sec. 11.1, p. 239) it is stated that

``After bootstrap, the system initialization is started in main
function of sys/kern/init_main.c'', which creates a process with
pid 0 (as specified in the comments at the beginning of the function
code).

On the other hand, in this blog post

 <http://blog.netbsd.org/tnf/entry/support_for_chdir_2_in>

it is stated that the init ``process owns all the other processes
in the computer, either directly or indirectly''; moreover, in the
subsequent examples (and also in the images) it seems that init is
the actual first process executed by the OS and that any other
process is originated from it.

Shouldn't then init be that process launched by init_main.c? Instead, I
found:

$ ps -aux -p 0
USER PID %CPU %MEM VSZ   RSS TTY STAT STARTED    TIME COMMAND
root   0  0.0  0.2   0 15172 ?   OKl  Mon10AM 9:57.64 [system]

$ ps -aux -p 1
USER PID %CPU %MEM   VSZ  RSS TTY STAT STARTED    TIME COMMAND
root   1  0.0  0.0 22700 1244 ?   Is   Mon10AM 0:00.01 init

So, what exactly is that process with pid 0 and what is its relation
with init?

Bye!

Rocky


Home | Main Index | Thread Index | Old Index