Linux PID 回收 [英] Linux PID recycling

查看:26
本文介绍了Linux PID 回收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux 中是否有关于回收使用过的 PID 的任何政策?我的意思是,如果一个 PId 已被使用,它会在多长时间后再次使用?

Is there any policy in Linux as to the recycling of used PIDs ? I mean, if a PId has been used, how much later will it be used again ?

推荐答案

随着新进程的出现,PID 将增加到依赖于系统的限制然后回绕.在这种回绕发生之前,内核不会重用 PID.

As new processes fork in, PIDs will increase to a system-dependent limit and then wrap around. The kernel will not reuse a PID before this wrap-around happens.

限制(pid 的最大数量)是 /proc/sys/kernel/pid_max.手册说:

The limit (maximum number of pids) is /proc/sys/kernel/pid_max. The manual says:

/proc/sys/kernel/pid_max(从 Linux 2.5.34 开始)

/proc/sys/kernel/pid_max (since Linux 2.5.34)

此文件指定了 PID 环绕的值(即此文件中的值比最大 PID 大 1).默认的此文件的值 32768 产生与 on 相同的 PID 范围早期内核

This file specifies the value at which PIDs wrap around (i.e., the value in this file is one greater than the maximum PID). The default value for this file, 32768, results in the same range of PIDs as on earlier kernels

这篇关于Linux PID 回收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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