Re: Detecting threads vs processes with ps or /proc

Nick LeRoy
2002-12-09T03:11:39Z

On Sunday 08 December 2002 06:24 pm, Albert D. Cahalan wrote:
> Robert Love writes:
> > On Fri, 2002-12-06 at 14:56, Nick LeRoy wrote:
> >> I was considerring doing something like this as well. From your
> >> experience, does it work reliably?
> >
> > It never fails to detect threads (no false negatives).
>
> Testing the algorithm on idle test processes won't show
> this damn-obvious race condition:
>
> 1. you read the first thread's info
> 2. the second thread calls mmap() and/or takes a page fault
> 3. you read the second thread's info

Yeah, I thought of that, too. Probably not too likely, of course, but it
still there. Murphy rules.

Robert: Any thoughts on this?

-Nick