How can I increase the number of threads that I can run in my Java applications under Linux?

Nathan Meyers

You can build a custom kernel with higher limits. In the include/linux/tasks.h file within a kernel source tree, you can increase the total number of system tasks (the NR_TASKS variable) up to 4092 - or 4090 if you're using the APM subsystem. In that file, you can also increase the number of tasks allowed to each user.

After setting the values you want, rebuild, reinstall, and boot the new kernel.