Re: How to know number of user threads from /proc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hi Kris,

On Sun, Feb 26, 2012 at 3:15 AM, emani murali <murali132@xxxxxxxxx> wrote:
> Hi,
>  I'm running a multithreaded program in OpenMP on linux to study CPU
> overloading. As the subject says, I need to know the number of threads this
> program creates (assuming in this case, number of threads in this program is
> same as the number of user threads) from the information kernel provides.
> I'm looking something similar to run-queue length from "sar -q 0" that gives
> me exact picture of number of user threads. From the implementation of sar,
> I found that this information is fetched from /proc filesystem.
> So is there anyway that /proc fs gives me the number of threads running in
> the system, apart from /proc/cpuinfo that gives me a static information of
> existing CPUs.

There is a directory in /proc/PID/task for each thread contained
within a process.

Dave Hylands
Shuswap, BC, Canada

Kernelnewbies mailing list

[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux