Create 1000 threads in linux-general Linux technology-Linux programming and kernel information. For more information, see. To create 1000 threads, run ulimit-s 2048 first.
It is almost impossible to solve this problem using a program.
According to the posix thread of RedHat Linux 9.0, the parent process of each thread is the current console process, rather than the process that calls pthread_create. On the other hand, the number of threads that can be created in a process is mainly limited by the stack size: 2G/maximum stack size allowed, on the i386 platform, the maximum stack size of the console process is 8 MB by default, so the number of threads that can be created is 2G/8 M = 256. However, the 8 m limit can be modified by running the ulimit command to indirectly increase the number of threads that can be created.
In this way, your question evolves to "can you modify the maximum stack size parameter of the console process through a program ?". I personally think this is difficult to achieve through conventional methods.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service