A
A
Alexey2012-06-11 16:42:04
linux
Alexey, 2012-06-11 16:42:04

Max_pid limit when creating a fork?

There is a certain script that constantly "forks" itself, the descendants do a small thing and die as it should.
Everything seems to work well, but when running more than 32,000 forks (this is the standard limit # cat /proc/sys/kernel/pid_max), Debian cuts off the reproductive function of the process, does not give the process the opportunity to run anything else (it does not matter if it is a fork or a process, nothing can be started at all).
Actually the question is how to make everything right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RubtsovAV, 2012-06-11
@ScorpLeX

Implement a thread pool or simply set a limit on the number of simultaneously running threads in the script itself.

while($forkCount >= $maxPid) sleep(5); 

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question