Re:The Linux kernel can spawn processes on its own
by CameronNemo on Saturday June 11, 2022 @07:57PM
(#31709717)
Yep, and aiui kthreadd on Linux always has a PID of 2. If you are ever trying to filter out kernel processes from ps output (and usermode helpers, apparently), you can check if the pid is 2 or ppid is 2.
Try this command:
The kernel-created processes will all have "kthreadd" as their Parent Process ID (PPID). Typically init and kthreadd are the only processes with a PPID of 0.