微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

是否按顺序在linux中分配了进程ID?

如果某个程序的pid为p,那么子进程(及其子进程)是否会有pid严格大于P?

当重复使用pid时,选择哪种pid,例如是最低的pid?

解决方法

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

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-generated

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐