windows PID = 0 有效吗?

发布于 2024-09-09 07:28:04 字数 77 浏览 2 评论 0原文

在Windows中,0是进程的有效PID还是操作系统保留的? 如果您可以提供一个指向文档的链接,说明它是保留的或什么的,那就太好了。 感谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情愿 2024-09-16 07:28:04

打开任务管理器 - 切换到进程选项卡(也许单击“查看”、“显示列”并启用 PID 列)。

PID 0 是系统空闲进程。由于该进程并不是真正的进程并且永远不会退出,因此我怀疑情况总是如此。

我没有可用的文档,但我很确定情况总是如此。

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.

纵山崖 2024-09-16 07:28:04

它没有在任何地方说明,但归结为内核句柄表的工作方式。这个相同的对象用于进程句柄和进程/线程 ID。恰好句柄值都从 0x4 开始,而 PsInitialSystemProcess 是第一个创建的进程,因此它的 PID 为 4。空闲进程实际上不是一个进程,您无法打开它。对于大多数意图和目的来说,它可能没有 PID,但大多数工具认为它是 0。

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.

终遇你 2024-09-16 07:28:04

PID 0 是为空闲“伪进程”保留的,就像 PID 4 是为系统(Windows 内核)保留的一样。

我找不到任何关于指定位置的文档,但通过任何 API(性能计数器、WMI)查询进程将始终为您提供 PID 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文