4 ms·
I wonder how this even works, as PID 1 should exit right away, no? And I thought this would lead to an immediate kernel panic?
by cvilgan 2y ago
I wonder how this even works, as PID 1 should exit right away, no? And I thought this would lead to an immediate kernel panic?
- megous 2y agoYeah, I'd say it simply doesn't work as described.
- halayli 2y agowhat do you mean pid 1 should exit right away? pid 1 is the init process and is the first and last process in the OS life cycle. All other processes run as child processes of init.
- cvilgan 2y agoAh, sorry, that was badly written. What I meant was that it looks like the shell script exits almost immediately, i.e. pid 1 forks the app process but then exits itself...
- halayli 2y agogot it. The confusion then is spawning(no pun) from the assumption that pid 1 script forks while it doesn't. It calls a program and wait for it to exit. Only then pid 1 exits and the system shuts down.