Re: linux-kernel-digest V1 #4149

cd_smith@ou.edu
Thu, 15 Jul 1999 18:12:43 -0500 (CDT)


I think we're arguing simultaneously over several things here, and they
are getting very confused with each other. I have no opinion on kernel vs
user level scheduling (just haven't looked hard enough to know). I
DEFINITELY like the clone() interface on Linux -- very clean, and very
flexible. But I do think you're wrong about one thing.

Larry McVoy <lm@bitmover.com> wrote:
> : 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.

And you conveniently choose a situation that involves multiple processes,
where the process group model is right. The above situation would be a
very dumb place to use threads, and it SHOWS in the fact that thread
behavior looks stupid.

I could just as easily give you a situation that lends itself to
threads. What about when I have a process with several threads handling
I/O events, and I get a SIGIO. I do NOT want any one particular thread to
receive the signal (that thread may be busy with a really long queue of
I/Os to process already). I do NOT want all threads to receive the signal
(one is fine, thanks). I want the signal to go to a thread (any thread)
that can handle it. THAT is what POSIX thread semantics do for signal
handling.

Different models for different needs, but processes and process groups
can't do everything. Not everyone who wrote POSIX is stupid.

> 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.

Actually, you can kill any one that is not blocking the signal at the
point that you send it (or one that has it masked but is blocked in
sigwait waiting to handle the signal). How do I do that under Linux right
now? I'm working on a patch that lets me do that... but it does add to
the interface quite a bit, because now I need to distinguish between
killing a whole process (group of tasks cloned with CLONE_PID) or killing
a task. Also, I think to get the POSIX semantics, I need to implement
blocked and pending signal masks for tasks AND processes, which adds
another syscall to set a task-specific signal mask.

> I can't kill a specific one.

Not from outside the process, anyway. A process is a single entity to
outsiders... under normal operation (not debugging), one process playing
with the internal details of how another process is implemented seems
pretty dumb to me. And I'm pretty sure that the Solaris debugger can
handle threads just fine -- we're only talking about standard interfaces.

Chris Smith <cd_smith@ou.edu>

-
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/