Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-10-2006, 01:45 PM
|
#1
|
LQ Newbie
Registered: Jun 2006
Location: South Africa
Distribution: Slackware
Posts: 7
Rep:
|
'ps' showing threads... grrr
Hi,
I've switched back to Slackware (from RedHat) when Slackware 10.1 was released. It's been mostly painless, but I have one niggling little thing left to understand.
Under RedHat9+/FC when you do a process list, the list would exclude application threads, showing processes as single line entries (as it should be).
With Slackware 10.2, 'ps' shows all the threads for the application as well.
I found some information on:
procps.sourceforge.net/faq.html
There, they state the following:
"Why do ps and top show threads individually?
The 2.4.xx kernel does not provide proper support for grouping threads by process. Hacks exist to group them anyway, but such hacks will falsely group similar tasks and will fail to group tasks due to race conditions. The hacks are also slow. As none of this is acceptable in a critical system tool, task grouping is not currently available for the 2.4.xx kernel. The 2.6.xx kernel allows for proper thread grouping and reporting. To take advantage of this, your programs must use a threading library that features the CLONE_THREAD flag. The NPTL pthreads provided by recent glibc releases use CLONE_THREAD."
Now, I'm using the 2.6.16.19 kernel and Slackware reports "NPTL 2.3.5" when I do a "getconf GNU_LIBPTHREAD_VERSION". That's fairly recent if I understand correctly, but threads still are displayed with a normal process list.
If I want to surpress the listing of threads, should I change something on 'ps' itself, or am I missing something else?
--deckert
|
|
|
06-10-2006, 02:06 PM
|
#2
|
Member
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211
Rep:
|
Mmm...I don't get a list of threads unless I explicitly tell ps to do so.
Maybe you should check the enviroment variables PS_PERSONALITY and CMD_ENV, they both should be either cleared or set to "linux".
Or perhaps you are actually telling ps to show you the thread info?
try "ps axu" or "ps -ely" (the "-" DO makes difference)
Last edited by theoffset; 06-10-2006 at 02:11 PM.
|
|
|
06-10-2006, 06:25 PM
|
#3
|
LQ Newbie
Registered: Jun 2006
Location: South Africa
Distribution: Slackware
Posts: 7
Original Poster
Rep:
|
Hi,
Quote:
Originally Posted by theoffset
Mmm...I don't get a list of threads unless I explicitly tell ps to do so.
|
It's a standard Slack 10.2 install without any mods, except for kernel 2.6.16.19, but I also tried it with the stock kernel now and I get the same thing.
Java threads all show up as zillions of processes. If I use ps -axf to get a 'forest' I can see the threads all dangling below the main java thread. Do the same on a RedHat box and you only see the process, not the threads. Specify ps -axf m and it shows the threads again.
I also checked PS_PERSONALITY, CMD_ENV and they're not set. There also aren't any aliases defined for 'ps' that may cause the threads to show.
Here's a sample of what it looks like:
Code:
root@machine:~# ps -axf
PID TTY STAT TIME COMMAND
2259 ? S 0:01 \_ /usr/local/java/jdk1.5/bin/java
2262 ? S 0:00 | \_ /usr/local/java/jdk1.5/bin/java
2263 ? S 0:20 | \_ /usr/local/java/jdk1.5/bin/java
2264 ? S 0:00 | \_ /usr/local/java/jdk1.5/bin/java
2265 ? S 0:01 | \_ /usr/local/java/jdk1.5/bin/java
2266 ? S 0:00 | \_ /usr/local/java/jdk1.5/bin/java
2267 ? S 0:00 | \_ /usr/local/java/jdk1.5/bin/java
2268 ? S 0:10 | \_ /usr/local/java/jdk1.5/bin/java
I'm baffled by this behaviour.
**EDIT**
Code:
Here's what it looks like on the RedHat box:
PID TTY STAT TIME COMMAND
4130 pts/9 Sl+ 1:42 \_ /usr/local/java/jdk1.5/bin/java -server -Xincgc -Xnoclassgc -Xms51
Note that 'ps' on the RedHat box correctly displays STATE "Sl+" indicating that the process is multi-threaded. I'm beginning to suspect either some thread brokenness in Slack 10.2 or a broken 'ps'.
--deckert
Last edited by deckert; 06-10-2006 at 07:55 PM.
|
|
|
06-10-2006, 11:07 PM
|
#4
|
Member
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211
Rep:
|
Code:
$ ps -afx
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
[...]
Looking in "man ps", there's no "-x" option (but there's a "x" option, without a leading "-").
Perhaps you wanted to run "ps afx" which will show you all processes in a three (but no threads)?
I'm thinking that maybe the RedHat's "ps" program is patched to detect this kind of typos and fix them... or maybe they are running another version of ps... just out of curiousity, what does RedHat prints with "ps --version" and what's the value of the already said variables?
EDIT: Just found out that the stat "Sl+" will only be shown when running a BSD command:
Quote:
Originally Posted by man_ps
For BSD formats and when the stat keyword is used, additional characters may be displayed:
[snip]
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
|
So maybe your PERSONALITY_PS or CMD_ENV are set to bsd under RedHat ??
EDIT 2:
Yep, I'm thinking that a PERSONALITY_PS=bsd might be the reason.
Code:
PERSONALITY_PS=bsd ps -afx
shows no Warning message and the threads are not shown. Also, the correct Stat code (Sl+) seems to be shown for threaded processes (in this case seamonkey-bin and bittorent-curses (python)).
Maybe you should set this variable in your .profile or the system-wide /etc/profile if you want the same behaviour than RedHat...
Last edited by theoffset; 06-10-2006 at 11:24 PM.
|
|
|
06-10-2006, 11:30 PM
|
#5
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Could you also post an example of what you'd EXPECT to get, or
what DeadRat displays with the same options?
Cheers,
Tink
|
|
|
06-11-2006, 06:15 AM
|
#6
|
LQ Newbie
Registered: Jun 2006
Location: South Africa
Distribution: Slackware
Posts: 7
Original Poster
Rep:
|
Hi,
Quote:
Originally Posted by theoffset
Code:
$ ps -afx
Warning: bad ps syntax, perhaps a bogus '-'? See procps.sf.net/faq.html
[...]
|
You get the above on a Slack 10.2 box? Mine doesn't give that error.
Quote:
Perhaps you wanted to run "ps afx" which will show you all processes in a three (but no threads)?
|
Did that too and the output remains the same.
Quote:
another version of ps... just out of curiousity, what does RedHat prints with "ps --version" and what's the value of the already said variables?
|
Here's the Slack 10.2 box:
Code:
root@machine:~# ps --version
procps version 3.2.5
And here's the RedHat box:
Code:
[tva@redhat-box ~]$ ps --version
procps version 3.2.3
As for the "Sl+" only being shown for BSD, I see that in the man page, but I'm not convinced that it is correct. I checked the PS_PERSONALITY and CMD_ENV variables under RedHat and they're not set.
From the man page:
For BSD formats and when the stat keyword is used...
That tells me that it's not only limited to the BSD formats. But even when specifying the 'stat' keyword the output does not show the l-flag ot the +-flag.
I also tried setting the PS_PERSONALITY and CMD_ENV to bsd under Slack 10.2, but the output still shows all the threads.
You refer to PERSONALITY_PS all the time, but the man page says one should set PS_PERSONALITY. Which one did you use?
Quote:
Maybe you should set this variable in your .profile or the system-wide /etc/profile if you want the same behaviour than RedHat...
|
Immm... but it doesn't work either way, so setting it globally won't help.
I appreciate the insistent help so far! :-)
--deckert
|
|
|
06-11-2006, 06:18 AM
|
#7
|
LQ Newbie
Registered: Jun 2006
Location: South Africa
Distribution: Slackware
Posts: 7
Original Poster
Rep:
|
Hi Tink,
Quote:
Originally Posted by Tinkster
Could you also post an example of what you'd EXPECT to get, or
what DeadRat displays with the same options?
|
:-) DeadRat indeed. The very reason I switched to Slack (for servers) is because of all the crap that gets installed (and started) with a default install.
I did post an example of what I get on the RedHat box at the end of my post #3 (after the EDIT).
--deckert
|
|
|
06-11-2006, 01:19 PM
|
#8
|
Member
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211
Rep:
|
Quote:
Originally Posted by deckert
Hi,
You get the above on a Slack 10.2 box? Mine doesn't give that error.
|
I originally tested it in my Slack --current, but just tested in a Slack 10.2 box and it shows the same warning when running "ps -afx"...
Quote:
Did that too and the output remains the same.
|
Funny, it should output something different... something is definitly wrong...
Quote:
Here's the Slack 10.2 box:
Code:
root@machine:~# ps --version
procps version 3.2.5
And here's the RedHat box:
Code:
[tva@redhat-box ~]$ ps --version
procps version 3.2.3
|
OK, it looks like they didn't patched ps, so my ramblings where wrong :P
Quote:
You refer to PERSONALITY_PS all the time, but the man page says one should set PS_PERSONALITY. Which one did you use?
|
Sorry, my fault. It is PS_PERSONALITY
Quote:
Immm... but it doesn't work either way, so setting it globally won't help.
I appreciate the insistent help so far! :-)
|
Well, I can't tell what's wrong. Your ps isn't showing the warning which is quite weird, and running "ps afx" instead of "ps -afx" doesn't seems to work... I must say that this one beats me
Still, I'm convinced that "ps -afx" is an invalid command (because of the "-x")...
Sorry. I give up.
Just two things: Just run the good 'ol "ps aux"... and Somebody else may know what's wrong??
Good luck.
|
|
|
All times are GMT -5. The time now is 10:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|