在Linux中是否按顺序分配了进程ID? [英] Are process IDs assigned sequentially in Linux?

查看:200
本文介绍了在Linux中是否按顺序分配了进程ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果程序的进程ID为P,则子进程(及其子进程)的进程ID是否严格大于P?

If a program has a process ID of P, will the child processes (and their children) have process IDs which are strictly greater then P?

重新使用进程ID时,会选择哪个进程ID,例如,最低的进程ID是否可用?

When process IDs are reused, which process IDs are chosen e.g., is the lowest process ID available?

推荐答案

来自 http://en. wikipedia.org/wiki/Process_identifier

通常从以下位置开始按顺序分配进程ID 0并上升到最大值,该最大值随系统的不同而不同. 达到此限制后,分配将在300重新开始 增加.在Mac OS X和HP-UX中,分配从100重新开始.但是, 为此和后续传递,仍分配给进程的任何PID 被跳过.有人认为这是潜在的安全性 漏洞,因为它允许有关系统的信息被 提取,或在进程之间秘密传递的消息.作为 这样,特别关注安全性的实现 可以选择其他PID分配方法.[1]在某些系统上 与MPE/iX一样,有时会使用最低的可用PID, 最大限度地减少内存中的过程信息内核页面的数量.

Process IDs are usually allocated on a sequential basis, beginning at 0 and rising to a maximum value which varies from system to system. Once this limit is reached, allocation restarts at 300 and again increases. In Mac OS X and HP-UX, allocation restarts at 100. However, for this and subsequent passes any PIDs still assigned to processes are skipped. Some consider this to be a potential security vulnerability in that it allows information about the system to be extracted, or messages to be covertly passed between processes. As such, implementations that are particularly concerned about security may choose a different method of PID assignment.[1] On some systems, like MPE/iX, the lowest available PID is used, sometimes in an effort to minimize the number of process information kernel pages in memory.

原始答案: https://superuser.com/questions/135007/how-are-pids-生成

这篇关于在Linux中是否按顺序分配了进程ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆