The following code is supposed to make 100,000 threads:
/* compile with: gcc -lpthread -o thread-limit thread-limit.c */
/* originally from: http://www.vol
pilcrow's mention of /proc/sys/vm/max_map_count is right on track; raising this value allows more threads to be opened; not sure of the exact formula involved, but a 1mil+ value allows for some 300k+ threads.
(For anyone else experimenting with 100k+ threads, do look at pthread_create's mmap issues... making new threads gets really slow really fast when lower memory is used up.)