Monday, 26 November 2018

Linux: How many processes where created during one minute?

I would like to know how many processes the Linux kernel created during a period of time.

Usually during one minute.

My background: If too many processes got created during a minute, then there is something wrong. Most of our legacy code base was moved from shell to python, but sometimes there are still some shell scripts which are slow because they a lot of processes.

I would like to create a graph from this number. Then I would like to check on which host and why so many processes got created.

I want to implement this with Python.

Answers how to read this from /proc or /sys would be great.

It would be nice if the solution works for the wrap around which happens if pid_max gets reached.

The limit (maximum number of pids) is /proc/sys/kernel/pid_max. The manual says:

/proc/sys/kernel/pid_max (since Linux 2.5.34)

This file specifies the value at which PIDs wrap around (i.e., the value in this file is one greater than the maximum PID). The default value for this file, 32768, results in the same range of PIDs as on earlier kernels



from Linux: How many processes where created during one minute?

No comments:

Post a Comment