From: Martin Zwickel <martin.zwickel@technotrend.de>
To: lm240504@comcast.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: Invisible threads in 2.6
Date: Tue, 25 May 2004 09:03:02 +0200 [thread overview]
Message-ID: <20040525090302.66ac23bf@phoebee> (raw)
In-Reply-To: <052520040221.14460.40B2AD9F00067A620000387C2200735834CBCFCACFCBCD0304@comcast.net>
On Tue, 25 May 2004 02:21:19 +0000
lm240504@comcast.net bubbled:
> 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?
my kernel:
# cat /proc/version
Linux version 2.6.6-rc3-mm2 (root@phoebee) (gcc version 3.3.2 20031218 (Gentoo
Linux 3.3.2-r5, propolice-3.3-7)) #6 Fri May 7 10:56:06 CEST 2004
I just compiled your example and ran it:
# ./thread_test
# ps axw
...
12069 pts/175 S+ 0:00 ./thread_test
12070 pts/175 S+ 0:00 ./thread_test
12071 pts/175 R+ 0:06 ./thread_test
12072 pts/175 R+ 0:06 ./thread_test
12073 pts/175 R+ 0:06 ./thread_test
12074 pts/175 R+ 0:06 ./thread_test
12075 pts/175 R+ 0:06 ./thread_test
12076 pts/175 R+ 0:06 ./thread_test
12077 pts/175 R+ 0:06 ./thread_test
12078 pts/175 R+ 0:06 ./thread_test
12079 pts/175 R+ 0:06 ./thread_test
12080 pts/175 R+ 0:06 ./thread_test
...
# top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12072 root 25 0 83736 420 1380 R 12.1 0.1 0:16.94 thread_test
12075 root 25 0 83736 420 1380 R 12.1 0.1 0:16.93 thread_test
12073 root 25 0 83736 420 1380 R 11.0 0.1 0:16.92 thread_test
12074 root 25 0 83736 420 1380 R 11.0 0.1 0:16.92 thread_test
12076 root 25 0 83736 420 1380 R 11.0 0.1 0:16.82 thread_test
12077 root 25 0 83736 420 1380 R 11.0 0.1 0:16.87 thread_test
12078 root 25 0 83736 420 1380 R 11.0 0.1 0:16.84 thread_test
12071 root 25 0 83736 420 1380 R 9.9 0.1 0:16.95 thread_test
12079 root 25 0 83736 420 1380 R 7.7 0.1 0:16.80 thread_test
...
On my -mm patched kernel I can see them.
Regards,
Martin
--
MyExcuse:
piezo-electric interference
Martin Zwickel <martin.zwickel@technotrend.de>
Research & Development
TechnoTrend AG <http://www.technotrend.de>
next prev parent reply other threads:[~2004-05-25 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-25 2:21 Invisible threads in 2.6 lm240504
2004-05-25 7:03 ` Martin Zwickel [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-25 18:51 lm240504
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040525090302.66ac23bf@phoebee \
--to=martin.zwickel@technotrend.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lm240504@comcast.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox