From: Albert Cahalan <albert@users.sf.net>
To: linux-kernel mailing list <linux-kernel@vger.kernel.org>
Cc: dizzy@roedu.net, yoush@cs.msu.su
Subject: Re: Status field in ps output for threaded programs in 2.6 kernel
Date: 12 May 2004 17:52:28 -0400 [thread overview]
Message-ID: <1084398747.955.466.camel@cube> (raw)
Mihai Rusu writes:
> On Wed, 12 May 2004, Nikita V. Youshchenko wrote:
>> Looks like kernel bug: displayed status of threaded process
>> should not be "S" if some threads are active. And CPU usage
>> statistics should correspond to all threads.
>
> Hmm I dont know about that. A "solution" here is to have top also
> display threads (like ps -m or ps -H of a recent procps distro).
First of all, "ps -H" does a process tree display.
You want one of these:
ps m Tru64 BSD style, with threads after process
ps -m Tru64 SysV style, with threads after process
ps H FreeBSD style, with loose threads (independent sorting)
ps -L Sun style, with grouped threads and LWP column
ps -T SGI style, with grouped threads and TID column
For process state, maybe have the kernel spit out a '*'
if not all threads are in the same state?
For CPU usage, Linux has been totally broken since day 1.
The SUSv3 and POSIX standard requires that the OS report
some notion of recent CPU usage. Linux doesn't bother.
BSD provides a decaying average, like a per-process
load average. AIX provides a simple average over a few
seconds. SysV provides something similar.
Here is what Solaris does:
You get both per-process and per-thread data. It is
provided as a fixed-point decaying average, with a
15-bit fraction. Thus:
0x8000 100%
0x6000 75%
0x4000 50%
0x2000 25%
0x0000 0%
With Linux, you get only the %CPU over the whole life
of the process. So a process that runs for months using
only 1% of the CPU will still appear to use 1% of the
CPU even after it gets stuck in a CPU-eating loop. You
can get around this by using "top", which is able to
compute a real %CPU from one refresh to the next.
next reply other threads:[~2004-05-13 0:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-12 21:52 Albert Cahalan [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-12 10:07 Status field in ps output for threaded programs in 2.6 kernel Nikita V. Youshchenko
2004-05-12 10:19 ` Mihai Rusu
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=1084398747.955.466.camel@cube \
--to=albert@users.sf.net \
--cc=dizzy@roedu.net \
--cc=linux-kernel@vger.kernel.org \
--cc=yoush@cs.msu.su \
/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