Maximum number of threads per process in Linux?

前端 未结 16 2792
轮回少年
轮回少年 2020-11-22 02:16

What is the maximum number of threads that can be created by a process under Linux?

How (if possible) can this value be modified?

16条回答
  •  北海茫月
    2020-11-22 02:43

    proper 100k threads on linux:

    ulimit -s  256
    ulimit -i  120000
    echo 120000 > /proc/sys/kernel/threads-max
    echo 600000 > /proc/sys/vm/max_map_count
    echo 200000 > /proc/sys/kernel/pid_max 
    
     ./100k-pthread-create-app
    

    2018 update from @Thomas, on systemd systems:

    /etc/systemd/logind.conf: UserTasksMax=100000
    

提交回复
热议问题