max thread per process in linux

后端 未结 5 1123
情书的邮戳
情书的邮戳 2020-12-25 08:54

I wrote a simple program to calculate the maximum number of threads that a process can have in linux (Centos 5). here is the code:

int main()
{
    pthread_t         


        
5条回答
  •  无人及你
    2020-12-25 09:31

    I had also encountered the same problem when my number of threads crosses some threshold. It was because of the user level limit (number of process a user can run at a time) set to 1024 in /etc/security/limits.conf .

    so check your /etc/security/limits.conf and look for entry:-

    username -/soft/hard -nproc 1024

    change it to some larger values to something 100k(requires sudo privileges/root) and it should work for you.

    To learn more about security policy ,see http://linux.die.net/man/5/limits.conf.

提交回复
热议问题