Shalom yuvalle1!
I believe that the threads implementation in newer Linux kernels is different than in RH 7.3. In particular, separate threads will no longer show up as separate processes (as in, having a separate PID).
I don't know of another way to count the threads of a process, but if I come across one, I'll let you know...
Update: What kernel is it? (what does uname -r say?) If it's 2.6, you may be able to use the /proc/$$/task directory. (Thanks to theorbtwo and ambrus for CB info).
| [reply] |
Hi edan!
Thanks for your reply. The thread implementation had changed, but not that dramatically - each thread has its pid and has a directory in /proc, so I was hoping that this module will still function (in vain). It seems that there is a group_id for each thread that equals the pid of the thread that created it. It is interesting that ps for example can give all the threads when it is used with the -m flag. I guess it is not that hard to count it myself using the /proc data, but I don't feel like it :)
The kernel version we are using here is 2.4.21-4.ELsmp
Thanks again for your help!
yuvalle1
| [reply] |
Yes, I've noticed this too. If you read the man page for ps, one of the switches is
-m show all threads
otherwise, all threads are combined under a single pid. I don't know whether Proc::ProcessTable takes this into account yet, but it's a resource hog to use; so you may be better off parsing ps -m yourself, or reading directly from /proc/pid.
I'm not really a human, but I play one on earth.
flash japh
| [reply] [d/l] |