← Back to context

Comment by loeg

1 day ago

This article (and comment you’re replying to) is about Linux, which does represent its own threads as pid 0. Yes, there are concepts that aren’t threads. Nevertheless, in a very real sense the kernel is a special process zero.

Again, no it's not. Most kernel code doesn't run as PID 0. What you're talking about is the idle task, a very small part of the kernel.

I also did have Linux in mind when writing my comment, but this is basic to how any major general purpose operating system works. Besides, I can't possibly exclude Linux when I say "any modern operating system."

  • The kernel has many, many threads other than the idle task. Ok, some of them technically have pids other than zero because this is how Linux implements threads. But they all share address space, like threads in any other process. I count, you know, 265 kernel threads on a random Linux system.

    • Some kernel threads, besides the idle task, have PIDs other than 0? You mean literally all of them.

      More crucially, kthreads are supplementary components of the Linux kernel. They represent just one method of running tasks asynchronously and don't represent the entirety of the kernel.

      At this point you’re arguing over technicalities to somehow validate your objectively incorrect statements. The kernel isn't "special process zero," period. The kernel isn't a process. You can't rely on a process to implement the machinery required to run processes. Furthermore, the parts that do have PIDs aren't even assigned PID 0, except for the idle task.