Linux中每个进程的最大线程数? [英] Maximum number of threads per process in Linux?
问题描述
Linux下一个进程最多可以创建多少个线程?
What is the maximum number of threads that can be created by a process under Linux?
如何(如果可能)修改此值?
How (if possible) can this value be modified?
推荐答案
Linux的每个进程限制没有单独的线程,只是系统上进程总数的限制(线程本质上是具有共享进程的进程在Linux上的地址空间),您可以这样查看:
Linux doesn't have a separate threads per process limit, just a limit on the total number of processes on the system (threads are essentially just processes with a shared address space on Linux) which you can view like this:
cat /proc/sys/kernel/threads-max
默认值为内存页数/4.您可以像这样增加它:
The default is the number of memory pages/4. You can increase this like:
echo 100000 > /proc/sys/kernel/threads-max
单个用户可以创建的进程(以及线程)数量也受到限制,有关这些限制的详细信息,请参见ulimit/getrlimit
.
There is also a limit on the number of processes (and hence threads) that a single user may create, see ulimit/getrlimit
for details regarding these limits.
这篇关于Linux中每个进程的最大线程数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!