A program that can creates number of threads depends upon the available virtual memory, Whenever each threads is created one stack is allocated to the thread generally each stack in linux and windows takes 1MB stack size.
while Linux restrict the number of process and number of maximum threads can be look in to :
and default is the number of threads is the memory pages/4 .
So total number of threads in a linux system can be calculated as below
number of threads = total virtual memory / (stack size*1024*1024)
So it conclude that number of threads can be increased by either increasing virtual memory or decreasing by stack size. But we can’t decreased stack size too much other wise we face stack overflow issue
60 total views, 5 views today