0

According to the manpage of sysinfo, the struct sysinfo has:

unsigned short procs;    /* Number of current processes */

But when I use sysinfo, the value of procs is the number of threads.

  • 1
    On Linux processes and threads are essentially the same thing. A thread is a process that shares the address space of its parent. – Barmar Apr 28 '17 at 19:21
  • @Barmar Multiple processes sharing a single address space? Sounds like something IBM would do. [Oh wait, they did!](https://en.wikipedia.org/wiki/Native_POSIX_Thread_Library) Yeah, I used to work on mainframes... :-) – Andrew Henle Apr 28 '17 at 20:25
  • Basically, Linux has separated the notions of scheduling and address space management. Internally, processes are scheduling entities. If two of these processes share the same address space, they're considered threads of the same process. – Barmar Apr 28 '17 at 20:27
  • I see there is no way to get the number of processes other than manipulating the "ps" command output or counting /proc/ directories. I expected linux to have to some function to get this value. – Punchirichechi May 01 '17 at 09:09

0 Answers0