Re: Thread implementations...

Richard Gooch (Richard.Gooch@atnf.CSIRO.AU)
Wed, 24 Jun 1998 09:16:39 +1000


David Wragg writes:
> alan@lxorguk.ukuu.org.uk (Alan Cox) writes:
> > > Both of these problem could be neatly solved if the kernel
> > > knew that thread-like processes live in teams. There are other
> >
> > Sort of a thread group like process group model. You need to do that
> > cleanly however to keep it fast and Linus happy.
>
> Last night I added a small amount of kernel support, so that I can
> modify LinuxThreads for direct thread creation and find out what the
> improvements to pthread_create might actually be.
>
> A CLONE_MINOR flag to clone creates a /minor process/. When a minor
> process clones/forks a new process, the parent of the new process is
> the parent of the minor process, rather than the minor process
> itself. So by using CLONE_MINOR, all the threads become child
> processes of the initial process.
>
> So for LinuxThreads using CLONE_MINOR, the initial process becomes the
> manager thread. Whenever a threads exits (by any means), the manager
> (as the parent) gets the child death signal. Hence it can accurately
> keep track of all live threads.
>
> The changes to the kernel are tiny, it fixes one problem nicely, and
> doesn't seem to create any new ones.

I like this solution. It's really simple and elegant. It takes care of
the dying thread problem. Now all you need to do is make use of
prctl(2) and you can solve the dying main thread problem.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu