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
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
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
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
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
What are the maximum number of threads possible per Process? Is it OS dependent? (1 Reply)
Discussion started by: digdarshan
1 Replies
6. Solaris
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
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
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
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
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
LEARN ABOUT HPUX
pthread_default_stacksize_np
pthread_default_stacksize_np(3T) pthread_default_stacksize_np(3T)
NAME
pthread_default_stacksize_np() - change the default stacksize
SYNOPSIS
PARAMETERS
new_size The new default stack size.
old_size Pointer to where the old default stack size is returned.
DESCRIPTION
The function allows an application to change the default value for the stacksize attribute. This function must be called before any
threads have been created. The new default stack size is passed in the new_size parameter. If not NULL, the previous default stack size is
returned in old_size. If new_size is zero, this function can be used (at any time) to query the current default stack size.
On HP-UX, threads with default stack sizes are cached after they terminate. The next time a thread is created with a default stack size, a
cached thread (and its stack) are reused. This can result in significant performance improvements for
However, if the default stack size is not appropriate for an application, it cannot take advantage of this performance enhancement. By
using the function, the threads library will change the default stack size so that it matches the applications needs. This allows the
application to utilize the performance benefit of cached threads.
RETURN VALUE
Upon successful completion, returns zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
[EINVAL] The value specified by new_size is less than
[EPERM] The calling process has already created threads (this must be called before any threads are created).
WARNINGS
If the environment variable is set with a valid value for default stack size, then it takes precedence over the invocation of interface.
However, it returns the current default stack size in old_size.
The maximum default stack size value that may be set through the environment variable is restricted to 10 MB; any value greater than 10 MB
will be rounded down to 10 MB.
Care should be taken while setting the default stack size limit since this could impact the maximum number of threads that can be created
in a process.
AUTHOR
was developed by HP.
SEE ALSO
pthread_attr_getstacksize(3T), pthread_attr_setstacksize(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_default_stacksize_np(3T)