Re: kernel thread support - LWP's

Richard Gooch (rgooch@atnf.csiro.au)
Fri, 16 Jul 1999 09:34:25 +1000


Larry McVoy writes:
> : On Wed, Jul 14, 1999 at 07:10:08PM -0600, Larry McVoy wrote:
> : > Given that that isn't an issue,
> : > can you think of a single technical reason why LWP's would be better?
> :
> : It's been a couple of years since I used threads on Linux, so this may be
> : out of date, but WTH.
> :
> : If you want to send a signal, you usually want to send it to a process,
> : not a particular thread.
>
> Nonsense. When I do
>
> $ cmd | cmd2 | cmd3
> and then hit ^C, I certainly do not want to kill one process, I want to
> kill all of them. There is this age old concept called process groups
> which makes this work. And process groups work just fine for killing a
> related group of cloned processes.
>
> : With the LWP model, there is a single PID,
> : shared by all the threads, making it easy to send the signal. Under
> : Linux, you have n PIDs for n threads. Which PID do you signal?
>
> This is just silly beyond words. The Linux model is _clearly_ the
> superset of the LWP model. Under Linux I can kill a specific thread
> or all of the threads, using the same interfaces Unix has had since v6
> or earlier. Under the LWP model, I can kill all the LWPs. I can't kill
> a specific one. And that's really a drag - maybe I want to use SIGUSR1
> or SIGHUP to turn on debugging on a per thread basis. Under Linux, that
> just works, with no new code to be written, no new commands to be added,
> no new model to be understood.

Yes, you could use process groups to emulate POSIX thread killing
semantics, but that requires your "heavyweight process" to switch to a
new process group. That might not always be what you want (and may
possibly violate POSIX). So I'd be happier if we could find some clean
and lightweight way of adding a new grouping mechanism so we can
properly support POSIX thread killing semantics *and* not interfere
with process groups.

Still, if we can't find a way of doing that cleanly, I'd rather we try
and get POSIX changed so that we can meet the spec. I hear there is a
final cleanup session starting soon. Worth a try, even if they say no.
As a minimal change, perhaps POSIX could say that the behaviour of
process groups is implementation-defined for threaded processes.

But let's first see what Chris Smith comes up with with in his process
grouping patch.

Regards,

Richard....

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