lkml.org 
[lkml]   [2000]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: SCO: "thread creation is about a thousand times faster than on


On 26 Aug 2000, David Wragg wrote:
>
> > The CLONE_WAITPID patches I don't remember, so please refresh my memory
> > about what they look like, and why they were needed in the first place..
>
> POSIX says that any thread can do a wait() et al. for a child process.
> But Linux currently thinks that a child processes is a child of a
> particular thread, and so only that thread can wait() for it.

Oh, ok.

I'd actually disagree with CLONE_WAITPID, then. Because as far as I can
tell, you may have two real cases:
- you want to wait on all _your_ children, as a part of a thread group.
- you want to wait on any child of a member in your thread group.

And the thread may want to do _both_ of these at different times. Which
implies that it is wrong to make this a "at thread-creation" flag. To me,
it sounds like it should just be a waitpid() flag, ie add a WTHREAD option
of waitpid and be done with it there instead. We'd already need to have
the list of threads, and they are protected by the same lock as the list
of children, so that shouldn't be very confusing at all...

The implementation looks absolutely trivial: change the wait4()
implementation to have one outer loop that loops over all the thread group
members - but only if WTHREAD is set.

(Note that you need this logic already even if you have the CLONE_WAITPID
flag, so if anything the WTHREAD flag is a simplification of
CLONE_WAITPID, because it makes the decision be a local one, not a global
one).

Oh, and pthreads probably needs to have the WTHREAD semantics by default,
so on second thought it really should be a "WNOTHREAD" to turn it _off_
instead.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.110 / U:3.740 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site