What is PID 0 in the Linux kernel

Which process has PID 0?


Reply:


From the Wikipedia page entitled: Process ID:

There are two tasks with specially defined process IDs: swapper or sched has the process ID 0 and is responsible for paging. They're part of the kernel rather than a normal user-mode process. Process ID 1 is usually the initialization process, which is mainly responsible for starting and shutting down the system. Process ID 1 was originally not reserved specifically for init by any technical measures: it only had this ID as a natural consequence of the first process called by the kernel. Newer Unix systems usually have additional kernel components that are shown as "processes". In this case, PID 1 is actively reserved for the init process to ensure consistency with older systems.

You can see the evidence of this by looking at the parent PIDs (PPIDs) of and:

is the kernel thread daemon. All kthreads are forked from this thread. You can see evidence of this by looking at other processes that are using their PPID and seeing who it is:

Notice they are all.






From the process identifier wiki:

There are two tasks with specially defined process IDs: swapper or sched has the process ID 0 and is responsible for paging. They're part of the kernel rather than a normal user-mode process.


The process with is the scheduler,

Description of the process ID:
0 The Scheduler
1 The init process
2 kflushd
3 update
4 kpiod
5 kswapd
6 mdrecoveryd

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.