Ana*_*tik 3 linux kernel threads ubuntu
我目前正在构建一个压力测试工具,因此我需要大量的线程。我已经完成了所有设置以提高限制,但最后一个设置,系统范围的上限/proc/sys/kernel/threads-max,我似乎无法更改。
我试过
sysctl -w kernel.threads-max=200000
Run Code Online (Sandbox Code Playgroud)
使用nano或手动编辑echo
echo 200000 > /proc/sys/kernel/threads-max
Run Code Online (Sandbox Code Playgroud)
编辑/etc/sysctl.conf和运行
sysctl -f
Run Code Online (Sandbox Code Playgroud)
如果我将它们作为 运行sudo,则不会显示错误(甚至显示新值),但是再次检查时,该值也没有更改。尝试使用 编辑值时gedit,它会吐出一个
无效的论点”
无论我尝试什么价值,即使是最初的价值。我更改pid_max值没有问题。
我真的不知道为什么它拒绝我的编辑,而且我找不到任何有类似问题的人,所以如果有人能解释发生了什么,我将不胜感激。
回应在于man proc(5),这是有趣的部分:
/proc/sys/kernel/threads-max (since Linux 2.3.11)
This file specifies the system-wide limit on the number
of threads (tasks) that can be created on the system.
Since Linux 4.1, the value that can be written to
threads-max is bounded. The minimum value that can be
written is 20. The maximum value that can be written
is given by the constant FUTEX_TID_MASK (0x3fffffff).
If a value outside of this range is written to threads-
max, the error EINVAL occurs.
The value written is checked against the available RAM
pages. If the thread structures would occupy too much
(more than 1/8th) of the available RAM pages, threads-
max is reduced accordingly.
Run Code Online (Sandbox Code Playgroud)
我假设您的内核版本 > 4.1,因此由于 200000(您尝试的数字)小于 0x3fffffff,问题看起来像是可用 RAM 不足。
| 归档时间: |
|
| 查看次数: |
5691 次 |
| 最近记录: |