lkml.org 
[lkml]   [2004]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectInvisible threads in 2.6
Date
I've been experimenting with process/thread accounting in 2.6.x,
and found this strange situation: if the leader thread of a multi-threaded
process terminates, the other threads become undetectable. After the
main thread becomes a zombie, /proc/<tgid>/task returns ENOENT on
open. If you happen to know the TID, you can access /proc/<tid>/* directly,
but otherwise, there is no way to observe the remaining threads, as far as
I can see. Consider this program, for example:

#include <pthread.h>

void *run(void *arg)
{
for(;;);
}

int main()
{
pthread_t t;
int i;
for (i = 0; i < 10; ++i)
pthread_create(&t, NULL, run, NULL);
pthread_exit(NULL);
}

When I run it, the system (predictably) goes to ~100% CPU utilization,
but there seems to be no way to find out who is hogging the CPU with
top(1), ps(1), or anything else. All they can show is the main thread in
zombie state, consuming 0% CPU.

I'm not sure how to fix this (the pid_alive() test seems to be there for a
reason), but it doesn't seem right. Any thoughts?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.058 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site