Re: Detecting threads vs processes with ps or /proc

From: Gilad Ben-Yossef (
Date: Sun Dec 08 2002 - 07:24:42 EST

On Fri, 2002-12-06 at 17:24, Nick LeRoy wrote:

> Our software (Condor) and some related software (Globus) is running on a
> number of systems around the world. Condor attempts to monitor the RAM usage
> of it's "user" (maybe "client" is a better word here) processes. If the
> client forks, we need to monitor the client and all of it's children, which
> really isn't difficult. The _problem_ is that if the client creates threads,
> it's impossible, from what we can tell, to tell the difference between
> separate threads and processes.
> So my question, I guess, is this. How can you tell, from user space, whether
> a group of processes are related as threads or through a "normal" child /
> parent relationship? The systems that we're running on currently are 2.2.19
> and 2.4.18/19.

There is another approach save for the one already discussed here, which
I have no idea how applicable it is in your case, but will produce 100%
reliable results without additional kernel support - track the processes

There are several ways you can go about it - there's the expensive (in
terms of CPU cycles) approach of using ptrace(2), the relativly painless
way of overriding the "default" calls to fork and friends via
magical LD_PRELOAD that nevertheless requires you control the execution
of the "client" programs and even using a system call tracking module
such as syscall-tracker ( which might not be
quite ready for use on a production system as of yet.

Hope this helps,

 Gilad Ben-Yossef <> 
 "Denial really is a river in Eygept."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Dec 15 2002 - 22:00:13 EST