Parameters that effects the total number of thread creation on LINUX OS are listed below:
1. PID: Increasing this value will help on large Linux system or clusters to ease process identification and process management.
2.Map count: The max_map_count file allows for the restriction of the number of VMAs (Virtual Memory Areas) that a particular process can own. A Virtual Memory Area is a contiguous area of virtual address space.
3.Threads-max: Linux doesn't have separate threads per process limit, just a limit on the total number of processes on the system (threads are essentially just processes with a shared address space on Linux).
4.Virtual memory i.e. swap space. : Linux supports virtual memory, that is, using a disk as an extension of RAM so that the effective size of usable memory grows correspondingly.
PID, map count and threads-max all these parameters effect the total number of threads creation on LINUX OS i.e. total number of threads created on LINUX can be increased by increasing the value of PID, map count and threads-max along with increased virtual memory i.e. swap space.
Below is the system configuration using these values. You can modify these values according to your system configuration:
Operation System: Red Hat Enterprise Linux 6.1 Processor: Intel Core i3 (3.07 GHz)
RAM: 4GB Swap Space: 8GB
The value of below parameters can be increased temporarily by using commands mentioned below :
Temporary change: Sysctl –w kernel.pid_max=200000
default value: 32768
2. Map count:
Temporary change: Sysctl –w vm.max_map_count=200000
default value: 65530
Temporary change: Sysctl –w kernel.threads-max=150000
default value: 57786
Swap Space: For increasing Swap Space temporarily and permanently refer to the following link:
To make these sysctl interface changes(i.e. PID, MapCount & Threads-max) permanent use following commands:
vi /etc/sysctl.conf and enter the following lines in this file:
# Controls the maximum number of PID
kernel.pid_max = 200000
# Controls the maximum number of threads
kernel.threads-max = 200000
# Controls the maximum number of virtual memory areas
vm.max_map_count = 200000
Press :wq to save and exit
By increasing the value of above four parameters number of threads increased in our case to 149639 from 32201.