Aigner, Thomas wrote:

        I did a man on top and sure enough there was a PPID command on
Linux (f then B) for parent process.  And yes, they always have the same
parent command.  Thanks for your help as I'm obviously still a noob on
Unix.
Nope, that doesn't tell you they're different threads in the same process -- look at all the obviously different processes whose PPID (parent PID) is "1" -- "ps -ef | less", the first screenful or so will all have a PPID of 1. A single process can have lots of different children and many do.

It does depend on which version you're running, but look for "thread" in the ps(1) man page. On the system I've got here it says "-m" shows all threads; 2.4-based machines may show all threads by default (but not RHEL3, which is closer to 2.6 than 2.4).

Although it's not definitive, finding processes with the exactly the same memory profile -- same resident set size (RSS), same total size (SIZE), etc is a bit of a giveaway: any two processes are unlikely to be using exactly the same amount of memory, any two threads are, by definition, using the same memory and must show the same statistics (well, to within stack size, but we can ignore that mostly).

Possibly a good way to look at this is with "top". The "H" key toggles threads (where it can detect them) and you get plenty good memory reporting. If you can see all your java threads then you'll see that they are all suspiciously similar.

Anyway, the reason that you see threads and processes confused is that there is very little difference between the two in Linux. Indeed, the lack of distinction caused some problems with the posix thread semantics that weren't fixed until 2.6 came out. If you're running a 2.6 kernel then look at /proc/<pid> where <pid> is the PID of the java process. In that you'll see a sub-directory called "task" which contains sub-directories for each thread, there's normally only one task, but multi-threaded processes will have several, eg

$ ps -e | grep java
29918 ?        00:02:38 java
$ ls /proc/29918/task
29918  29920  29922  29924  29928  29930  29937  8993
29919  29921  29923  29925  29929  29934  6875   917

jch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to