Linux limits on threads per process


I came across an interesting learning on number of threads a process can hold.

# of threads per process = total virtual memory / (stack size*1024*1024)


  • Increase in virtual memory can directly leads to increase in # threads per process. Virtual memory can be at most swap memory
  • Increase in stack size decreases # of threads per process


Check Virtual Memory: 

ulimit -v (default is unlimited, thus you need to increase swap memory to increase this)

Total Stack Size:

ulimit -s (default is 8Mb)

Command to update these values:

ulimit -s newvalue

ulimit -v newvalue

Reference
https://dustycodes.wordpress.com/2012/02/09/increasing-number-of-threads-per-process/

Comments

Popular posts from this blog

AWS S3 Bucket limitations

Gradient descent algorithm in Machine learning

Amazon DynamoDB Standard-IA vs DynamoDB Standard