Does the Max processes in /proc/<pid>/limits signifies the maximum number of child processes for that process

StackOverflow https://stackoverflow.com/questions/22160337

  •  19-10-2022
  •  | 
  •  

Question

What does the Max processes in /proc//limits signifies?

Does it signifies maximum number of child processes for that process??

How to limit number of child processes for a particular process at runtime in linux?

cat /proc/<pid>/limits

Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             29397                29397                processes 
Max open files            1024                 4096                 files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       29397                29397                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        

No correct solution

OTHER TIPS

That number is exactly what you would get by doing getrlimit on RLIMIT_NPROC. That is described in the manual page:

The maximum number of processes (or, more precisely on Linux, threads) that can be created for the real user ID of the calling process. Upon encountering this limit, fork(2) fails with the error EAGAIN.

So every time you fork the system checks all your processes before allowing this one process to fork. If you lower the limit for some process - perhaps with ulimit for the shell or with setrlimit - the system still counts all your processes but it checks the number against the new limit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top