#linux #pid
PID 0 does exist, it’s the one thread that starts the kernel, provided by the bootstrap CPU core.
PID 0 runs early kernel initialization, then becomes the bootstrap CPU core’s idle task, and plays a minor supporting role in scheduling and power management.
PID 0 has nothing to do with memory management. In early Unix kernels it did some incidental memory management as part of process scheduling. PID 0 stopped doing that many decades ago.
On Linux, “PID” is ambiguous because userspace and the kernel use “PID” to refer to different values: the TID for the kernel, and the TGID for userspace. The kernel’s definition wins in practice for PID 0, because none of the entities that make up PID 0 are visible to userspace through the traditional Unix APIs.
source: https://blog.dave.tf/post/linux-pid0/