Maximum number of threads per process in Linux?

前端 未结 16 2793
轮回少年
轮回少年 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:48

    Yes, to increase the threads number you need to increase the virtual memory or decrease the stack size. In Raspberry Pi I didn’t find a way to increase the virtual memory, if a decrease the stack size from default 8MB to 1MB It is possibly get more than 1000 threads per process but decrease the stack size with the “ulimit -s” command make this for all threads. So, my solution was use “pthread_t” instance “thread class” because the pthread_t let me set the stack size per each thread. Finally, I am available to archive more than 1000 threads per process in Raspberry Pi each one with 1MB of stack.

提交回复
热议问题