How do I get the number of processes that have been created since the last boot on a Linux machine?
I want to get it from a C++ program. Which proc file stores it?
That would be in
The "processes" line gives the number of processes and threads created, which includes (but is not limited to) those created by calls to the fork() and clone() system calls.
Documentation/filesystems/proc.txt in your kernel source tree for more information about the contents of
Remember to never discount the Linux man pages. I am putting a link below, to the one for /proc.
To add to the answer given by Sami Laine, According to the above linked page,
/proc/stat has a common entry:
processes 86031 Number of forks since boot.
As a side note(slightly off subject), if you are looking to see this data on a SPECIFIC process, and not "in general", you should use,
Provides much of the information in /proc/[pid]/stat and /proc/[pid]/statm in a format that's easier for humans to parse.