为什么Windows任务管理器中没有进程1、2或3?

When you take the time to look at all the little details in Windows, you often find little curiosities. Like why, for example, are Process Identification Numbers 1, 2, and 3 never assigned to anything in the Windows Task Manager?

当您花时间查看Windows中的所有小细节时,通常会发现很少的好奇心。 例如,为什么为什么Windows任务管理器中的进程标识号1、2和3从未分配给任何对象?

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

问题 (The Question)

SuperUser reader Agovizer took a long hard look at the table Process display table in the Windows Task Manager and came back with some questions, specifically:

超级用户读者Agovizer仔细研究了Windows任务管理器中的表Process显示表,并提出了一些问题,特别是:

What processes, if any, exist between PIDs 0 and 4 on Windows 7? Just out of curiosity what are the processes between 0 and 4, and also between 4 and 200 something.

Windows 7的PID 0和PID 4之间存在什么进程(如果有)? 出于好奇,刚好在0和4之间以及在4和200之间的过程是什么。

We hopped over into the Task Manager on our machine and sure enough there were no processes assigned in slots 1, 2, and 3–although our PIDs jumped from 4 to 340, as opposed to his 4 to 200.

我们跳到机器上的任务管理器中,确保在插槽1、2和3中没有分配任何进程,尽管我们的PID从4跳到340,而不是4跳到200。

答案 (The Answer)

SuperUser contributor G Koe closes the case in one swoop:

超级用户贡献者G Koe一口气结案:

There is no Process ID 1, 2, or 3 because of how the NT kernel handle table works.

由于NT内核处理表的工作方式,因此没有进程ID 1、2或3。

Handles are always multiples of four. The Kernel handle process object is used for both process handles and process/thread IDs. It happens that handle values all start at 0x4 (bit 2), and the InitialSystemProcess 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 real PID but most tools consider it to be 0.

句柄始终是四个的倍数。 内核句柄进程对象用于进程句柄和进程/线程ID。 碰巧句柄值都从0x4(位2)开始 ,并且InitialSystemProcess是要创建的第一个进程,因此它的PID为4。空闲进程实际上不是一个进程,您无法打开它。 它可能没有真实的PID,但是大多数工具都将其设为0。

More on the NT handle table here although this is only accurate for NT3-5(xp) , as Windows 7 now requires that you only reference kernel handles if attached to PsInitialSystemProcess.

关于NT句柄表的更多信息,尽管这仅对NT3-5(xp)正确,因为Windows 7现在要求您仅在连接到PsInitialSystemProcess时引用内核句柄。

More on Windows 7/8 Handle limits from Mark Russinovich

Mark Russinovich的Windows 7/8句柄限制的更多信息

More on the “multiples of four” in PIDs

更多关于PID的“ 4的倍数”

Everything he suggests checks out: we’re missing 1, 2, and 3 (not multiples of 4) and every PID value in our list from 340 to 13136 is divisible by 4.

他建议的所有内容都会检查出来:我们缺少了1、2和3(不是4的倍数),并且列表中从340到13136的每个PID值都可以被4整除。



Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不对。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/149229/why-are-there-no-processes-1-2-or-3-in-my-windows-task-manager/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值