Autore: Rainer Weikusat Data: To: dng Oggetto: Re: [DNG] Runit init system discussed at GoLUG, Wednesday, 3/1/2023,
7pm Eastern Standard
Didier Kryn <kryn@???> writes: > Le 03/03/2023 à 21:29, Rainer Weikusat via Dng a écrit :
[...]
>>> Init has various tasks to perform, which differ largely between
>>> the different steps of the system lifetime.
>> [...]
>>
>> It actually doesn't, at least not in the sense you're using tasks. init
>> is a program the kernel whill start in a process created for this
>> purpose after its ready to respond to application requests (via system
>> calls). It has not system defined purpose as it's application, that is,
>> user code. It can do whatever a user wants it to do.
>>
>> The first process is special in two respects (possibly in more, these
>> are the two I know about):
[...]
> Even with this definition, the only thing the kernel cares is
> pid1, /the process/, not the executable it actually runs, and this
> executable can change over time and actually does change. In pretty
> much every distro, the first init is run in an initramfs; then, when
> the mandatory filesystems have been mounted, this first init
> /executes/ /usr/sbin/init -- it actually performs a sequence of
> pivot_root() and execve(), by the mean of an utility which can be
> pivot_root or switch_root.
>
> Later on, nothing prevents this program to /execute/ any other
> program. As long as it remains pid1, it remains the one in charge to
> reap orphan processes, the one which has a special management of
> signals, and the one the kernel does not want to exit. Therefore, it
> is only the /process/ with pdi 1 the kernel cares of.
That's basically an expanded repetition of what I wrote in the quoted
paragraph: init or whatever is run as initial process (can be changed
via kernel command-line parameter) has no system-defined fixed
semantics. It's just an application like all other applications and can
do everything other applications can do except exiting (technically, it
can, but this will then emergency-halt the system). It ought to get rid
of orphaned zombies, otherwise, the system will eventually run out of
memory, but the kernel has no power to make it do this (and no processes
will ever be orphaned unless init creates new processes).