Re: Killing clones

H. Peter Anvin (hpa@transmeta.com)
14 Aug 1997 08:48:23 GMT


Followup to: <199708140813.LAA10426@pl347.mail.helsinki.fi>
By author: mjr@iki.fi
In newsgroup: linux.dev.kernel
>
> On 14 Aug, Albert D. Cahalan wrote:
> > For proper balance, normal processes need a single thread.
>
> Hmm, essentially true.
>
> > Symmetry requires numbering unthreaded processes from 0x10000.
> > They still show up with low numbers and can be killed with the
> > low numbers.
> >
> > That gets rid of some special case code for thread #1.
>
> Yes. Additionally, the POSIXly correct killing could still be controlled
> by a flag I suggested in my previous post, with even less special cases.
> (Though POSIX signaling to threads brings some special cases, I think -
> for example, at least SIGKILL, SIGSTOP and SIGCONT would have to be sent
> to all threads. That's the impression I have, anyway. These would also
> be non-trivial to implement in userspace, which kind of supports
> putting them in the kernel... At least I failed to come up with a
> working solution in the last two minutes :)
>

Also, you need to have getpid() and gettid() be different library
functions, to not completely hose over processes who aren't aware of
the state of affairs; they can of course be implemented in terms of
the same syscall, although keeping a getpid() syscall around might be
better for a whole bunch of reasons, one of them would be that the
internal structure of pid's and tid's would not have to be visible to
user space.

In particular, I think it would be bad to have an implementation of
/proc that required one to have knowledge of the internal structure of
tid's, unless we're darned sure we'll never need to change it...

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
Always looking for a few good BOsFH.  **  Linux - the OS of global cooperation
        I am Baha'i -- ask me about it or see http://www.bahai.org/