0
  1. Where and how are Linux processes and threads configured?

  2. What is the name of the underlying Linux resource that manages processes and threads and determines their total number?

  3. Is there a limit on, and if so, what is the total number of threads & processes that can be created in a Linux system?

octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
ind79ra
  • 149
  • 2
  • 13
  • 1
    1) Memory. 2) That depends on the memory available. Related: http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux. – Frédéric Hamidi Jun 08 '12 at 10:17

1 Answers1

2

There is a bunch of sysctls and ulimits that relate to this.

Threads and processes on linux are both created with the clone syscall under the hood, and are all in fact the same thing, just with different parameters. So when you see "process" related settings on linux, they are also thread related settings most of the time.

$ ulimit -u

...will get/set the max user processes

You also need to look at:

/etc/security/limits.conf

and of course:

/proc/sys/kernel/threads-max

I've had upwards of 10000 threads running no problem at all on a 64-bit system. If you need more than that you are better off doing cooperative multitasking, and handle the "task scheduling" yourself.

Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319