Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
In Windows, is 0 valid PID for a process or is it reserved by OS?
It would be nice if you can provide a link to a doc that says it is reserved or what.
Thank!
Open task manager - switch to the processes tab (maybe click "View", "Show columns" and enable the PID column).
PID 0 is the System Idle Process. Since that process isn't really a process and never exits, I suspect that it is always the case.
No documentation available to me, but I'm pretty certain this is always going to be the case.
It's not stated anywhere but it comes down to how the kernel handle table works. This same object is used for both process handles and process/thread IDs. It happens that handle values all start at 0x4, and PsInitialSystemProcess is the first process to be created, so it gets a PID of 4. Idle process isn't actually a process and you can't open it. It probably doesn't have a PID for most intents and purposes but most tools consider it to be 0.
–
The PID of 0 is reserved for the Idle "psuedo-process", just like PID of 4 is reserved for the System (Windows Kernel).
I can't find any documentation on where that is specified, but querying the processes via any API (Perf Counters, WMI) will always give you the idle process for PID 0.
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.