Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
Just trying to figure out some stuff with a broken process.
A java app seems to sometime get stuck on a loop or something and i'm trying to find out what's causing it using just the following #sysadmin tools at my disposal.
Things like:-
htop - find the PID thats causing the High CPU cycles.
I'd then want to use /proc/[PID] or lsof -p [PID] or strace [PID] etc...
But the PID doesn't exist in 'ps -ef' output so I think htop must be showing me kernel level thread PIDs?
Not sure about the PID's HTOP is actually giving me? I know that some of them are the real PID's that can be accessed through /proc/[pid] etc but others are not but are i assume child processes or more likely threads as child processes are normally shown in a default ps output anyway.
Is someone able to help distinguish to me about what exactly all these other PID's are that I can't manipulate or find apart from when using HTOP.
So htop when in tree view would show this PID as a child of Java process 30996, which is stuck in a loop or something seeing as its 99% CPU. Easy for me to fix I can just re-start the Java App and everything would be working again. But i'm using this as a little exercise to see if I can find what's going on - but more importantly try to understand why htop shows more results than a PS output. My assumption is still that htop is able to show and work out the threads that a process has or something, but i'm still yet unsure of why i would be unable to diagnose these further...
I'd stop using htop; it's obviously dreaming up PIDs. Use top instead.
I verified that it's being stupid on my machine (installed 0.9 on my
machine from source, just out of curiosity). It's showing processes
that clearly don't exist (/proc/<PID> is authoritative), and no, xmms
(htop showed my system to have 3 xmms processes) doesn't have any
phantom kernel level threads ;} ...
To highlight the difference between processes and threads in htop:
1. press F2
2. select "Display options"
3. enable "Display threads in a different color"
Most people talking of the ability for Htop to pick-up on Kernel or UserLand Threads. Maybe its just something HTOP does or something but doesn't really mean much? Any ideas?
I mean what Htop is showing me in output is very related to what i'd expect to see to an extent.. Its just confusing as i say that i'm not able to diagnose further the so called 'threads' how you would a normal PID...
When i went into htop and tree view and manually counted them... i counted 69 threads, based on the point the number of threads is always changing but would probably stay around this number, I make the assumption the two numbers are closely related?
I'm now looking about the proc/30996 files etc to see if i can find anything more pertaining to these so called 'threads'...
EDIT:
Code:
ps -eLF
Shows all the same threads I can see with htop...
According to man page for ps...
-L = "Show threads, possibly with LWP and NLWP columns"
lwp (light weight process, or thread) ID of the lwp being reported. (alias spid, tid).
nlwp NLWP number of lwps (threads) in the process. (alias thcount).
OK, think i'm getting somewhere now.. would still be interesting to know if there's anyway to diagnose further the LWP then with strace/lsof/proc etc? Or i guess it has to be done from the PID- something to do with 2.6 kernel not showing everything as a single process like the 2.4 kernel does perhaps. (noting i've only ever been using Linux with a 2.6 kernel)
Last edited by helptonewbie; 12-29-2010 at 04:31 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.