Hacker News new | ask | show | jobs
by throwaway7356 894 days ago
> That is all that 'init' ever is, or ever was!

Except it is not. The "init" process seen by users as PID 1 on the usual Linux distributions is far from the first program started by the kernel. There are usually hundreds of processes started before that PID 1 process gets started.

1 comments

>There are usually hundreds of processes started before that PID 1 process gets started.

By the time PID 1 is started, the OS has run OS code, or more specifically, prior to PID 1 being ran, the OS has run OS code -- that much is true!

Loosely, you are calling that OS code -- "processes"

We could call that OS code "processes" -- however, there is a difference between this loose definition of what a "process" is, and what a "process" is defined to be by Unix/Linux standards and conventions.

The OS code that the OS runs, the kernel code -- typically does not have a 'PID' (Process ID) associated with any of it.

To understand this, let's remember what Unix/Linux (or any OS) is -- it's software abstraction layer over hardware.

It's goal is to act as a hardware abstraction layer, but also as a moderator, a resource arbiter for other pieces of software, other code -- to run on the same hardware, the same machine, at the same time.

This other code -- is typically the user space (AKA non-privileged) software, the user-space code.

In order to manage that user-space code, AKA user programs, AKA user-installed software and because several (or more) of these programs might be and probably will be running simultaneously, a unique postive integer handle (functionally the equivalent of a key in key-value programming).

That unique positive integer handle assigned to each user-space program (unique ones can also be assigned to threads of programs) -- is typically the PID, or Process IDentifier.

That's WHY they exist.

PID 1 is the Process Identifier for the first user-space program to be run by the operating system, typically 'init' -- or a descendant.

If "There are usually hundreds of processes started before that PID 1 process gets started", which is what you're calling "processes" (kindly disambiguate exactly what you mean when you say "process" please!), then WHY is it that they are not given ascending unique positive integer numbers and WHY does this numbering, should it exist, force PID 1 to be some other higher-numbered PID?

If "hundreds of [user-space] processes [are] started before that PID 1 process gets started", then WHY exactly, is the first ran user-space program PID 1 -- and not some higher numbered PID?

?

???