Sponsored Content
Top Forums Programming Count Number Of Threads in a Process Post 33161 by S.P.Prasad on Wednesday 18th of December 2002 06:11:28 AM
Old 12-18-2002
Count Number Of Threads in a Process

I am trying to find out that how many number of threads are currently running or in any other state which is created by POSIX standard in a process.
First I have defined a variable called proc_var of type proc defined in sys/proc.h.Next I open up the dir /proc and per directory wise I do an ioctl operation with cmd type PIOCPSINFO and target as address space of proc_var. But when I print the value of the member variable p_lwpcnt of proc_var ( i am not sure wether i am reffering to the correct one ) , i get output '6488064' as its value.I found out that the process is a user created one and the code creates only four threads.
Kindly guide me how to find the correct number Threads and its details, currently executing in a process.
 

10 More Discussions You Might Find Interesting

1. HP-UX

how to see the threads count of a process in hp unix?

hi,all: how to see the threads count of a process in hp unix? thanks (2 Replies)
Discussion started by: bugbugbug
2 Replies

2. Linux

Maximum number of threads handled by a process????

Hi Anybody knows max. no. of threads handled by a process in linux. Please reply Thanks in advnce :confused: (0 Replies)
Discussion started by: Agnello
0 Replies

3. UNIX for Advanced & Expert Users

Threads and Threads Count ?

Hi all, How can I get the list of all Threads and the Total count of threads under a particular process ? Do suggest !! Awaiting for the replies !! Thanks Varun:b: (2 Replies)
Discussion started by: varungupta
2 Replies

4. HP-UX

Need help. Unable to create threads after a certain number

Hi, I have a process which creates pthreads to generate some reports. After creating the reports these threads return null. But after 1024 threads, the process is not able to create any threads further.,and at max 5 threads are existing simultaneously and are returning the control back after... (2 Replies)
Discussion started by: Krsh
2 Replies

5. UNIX for Advanced & Expert Users

threads per process

What are the maximum number of threads possible per Process? Is it OS dependent? (1 Reply)
Discussion started by: digdarshan
1 Replies

6. Solaris

Number of threads running

Is there any command to find 1) the number of threads running 2) kernel boot mode in solaris box (2 Replies)
Discussion started by: vickylife
2 Replies

7. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

8. AIX

How to list all threads in a running process

Hello, On Linux, I can use 'ps -efL | grep process_name' to list all threads that belong to a running process. -L has a different meaning on AIX and I could not find an equivalent flag in the man pages. Does anyone know of a way to dump the threads under a running process? Thanks,... (2 Replies)
Discussion started by: makodarear
2 Replies

9. SuSE

Configuring Number Threads

I have this error message from the logs of Zimbra email running on SUSE 11.2 Is the thread maximum of 20 an operating system parameter, or is it part of the application code, or part of the java run time? Part two, how would I increase that number? (3 Replies)
Discussion started by: jgt
3 Replies

10. HP-UX

How to get number of threads for single java process on HP-UX OS?

Hi All, When i was trying to get total number of threads per java process using this command ps -o NLWP PID, I'm not getting any output. Could someone help me in this issue. Thanks, GMar (1 Reply)
Discussion started by: mgangumolu
1 Replies
PROCFS(5)						      BSD File Formats Manual							 PROCFS(5)

NAME
procfs -- process file system SYNOPSIS
proc /proc procfs rw 0 0 DESCRIPTION
The process file system, or procfs, implements a view of the system process table inside the file system. It is normally mounted on /proc, and is required for the complete operation of programs such as ps(1) and w(1). The procfs provides a two-level view of process space, unlike the previous FreeBSD 1.1 procfs implementation. At the highest level, pro- cesses themselves are named, according to their process ids in decimal, with no leading zeros. There is also a special node called curproc which always refers to the process making the lookup request. Each node is a directory which contains the following entries: Each directory contains several files: ctl a write-only file which supports a variety of control operations. Control commands are written as strings to the ctl file. The con- trol commands are: attach stops the target process and arranges for the sending process to become the debug control process. detach continue execution of the target process and remove it from control by the debug process (which need not be the sending process). run continue running the target process until a signal is delivered, a breakpoint is hit, or the target process exits. step single step the target process, with no signal delivery. wait wait for the target process to come to a steady state ready for debugging. The target process must be in this state before any of the other commands are allowed. The string can also be the name of a signal, lower case and without the SIG prefix, in which case that signal is delivered to the process (see sigaction(2)). The procctl(8) utility can be used to clear tracepoints in a stuck process. dbregs The debug registers as defined by struct dbregs in <machine/reg.h>. dbregs is currently only implemented on the i386 architecture. etype The type of the executable referenced by the file entry. file A symbolic link to the file from which the process text was read. This can be used to gain access to the process' symbol table, or to start another copy of the process. If the file cannot be found, the link target is 'unknown'. fpregs The floating point registers as defined by struct fpregs in <machine/reg.h>. fpregs is only implemented on machines which have dis- tinct general purpose and floating point register sets. map A map of the process' virtual memory. mem The complete virtual memory image of the process. Only those address which exist in the process can be accessed. Reads and writes to this file modify the process. Writes to the text segment remain private to the process. note Used for sending signals to the process. Not implemented. notepg Used for sending signal to the process group. Not implemented. osrel Allows read and write of the kernel osrel value assigned to the process. It affects the compatibility shims that are turned on and off depending on the value. Initial process value is read from the ABI note tag in the executed ELF image, and is zero if the tag not supported by binary format or was not found. regs Allows read and write access to the process' register set. This file contains a binary data structure struct regs defined in <machine/reg.h>. regs can only be written when the process is stopped. rlimit This is a read-only file containing the process current and maximum limits. Each line is of the format rlimit current max, with -1 indicating infinity. status The process status. This file is read-only and returns a single line containing multiple space-separated fields as follows: o command name o process id o parent process id o process group id o session id o device name of the controlling terminal, or a minus sign (``-'') if there is no controlling terminal. o a list of process flags: ctty if there is a controlling terminal, sldr if the process is a session leader, noflags if neither of the other two flags are set. o the process start time in seconds and microseconds, comma separated. o the user time in seconds and microseconds, comma separated. o the system time in seconds and microseconds, comma separated. o the wait channel message o the process credentials consisting of the effective user id and the list of groups (whose first member is the effective group id) all comma separated. o the hostname of the jail in which the process runs, or '-' to indicate that the process is not running within a jail. In a normal debugging environment, where the target is fork/exec'd by the debugger, the debugger should fork and the child should stop itself (with a self-inflicted SIGSTOP for example). The parent should issue a wait and then an attach command via the appropriate ctl file. The child process will receive a SIGTRAP immediately after the call to exec (see execve(2)). Each node is owned by the process's user, and belongs to that user's primary group, except for the mem node, which belongs to the kmem group. FILES
/proc normal mount point for the procfs. /proc/pid directory containing process information for process pid. /proc/curproc directory containing process information for the current process /proc/curproc/cmdline the process executable name /proc/curproc/ctl used to send control messages to the process /proc/curproc/etype executable type /proc/curproc/file executable image /proc/curproc/fpregs the process floating point register set /proc/curproc/map virtual memory map of the process /proc/curproc/mem the complete virtual address space of the process /proc/curproc/note used for signaling the process /proc/curproc/notepg used for signaling the process group /proc/curproc/osrel the process osrel value /proc/curproc/regs the process register set /proc/curproc/rlimit the process current and maximum rlimit /proc/curproc/status the process' current status EXAMPLES
To mount a procfs file system on /proc: mount -t procfs proc /proc SEE ALSO
procstat(1), mount(2), sigaction(2), unmount(2), procctl(8), pseudofs(9) AUTHORS
This manual page written by Garrett Wollman, based on the description provided by Jan-Simon Pendry, and revamped later by Mike Pritchard. BSD
April 22, 2013 BSD
All times are GMT -4. The time now is 04:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy