LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How many thread can be created in user space program? (https://www.linuxquestions.org/questions/linux-networking-3/how-many-thread-can-be-created-in-user-space-program-481191/)

Honor 09-07-2006 04:04 AM

How many thread can be created in user space program?
 
Does the kernel have define the maximum thread number?

Thanks in advance.

stress_junkie 09-08-2006 06:45 AM

Kernel system wide maximum.
Code:

$ cat /proc/sys/kernel/threads-max
16383

Variable limit set per user during login.
Code:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size          (kbytes, -d) unlimited
file size              (blocks, -f) unlimited
pending signals                (-i) 8191
max locked memory      (kbytes, -l) 32
max memory size        (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues    (bytes, -q) 819200
stack size              (kbytes, -s) 8192
cpu time              (seconds, -t) unlimited
max user processes              (-u) 8191
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
$

Note that the ulimit values shown are okay for an interactive user on a workstation. Server processes such as ftp should have lower limits in order to avoid being susceptible to a fork attack. A fork attack is when a bad guy "freezes" your server by causing some remotely accessible process such as a server daemon to spawn a gajillion subprocesses. This overwhelms the kernel's ability to manage resources and the system will hang.


All times are GMT -5. The time now is 05:23 AM.