Re: linuxthreads and tid testing

Eric PAIRE (eric.paire@ri.silicomp.com)
Fri, 30 Jul 1999 08:23:59 +0200


> > I'm interested in fixing this problem, but the linuxthreads implementation is
> > the only one I've seen the source to, so it's the only one I fully understand.
> > We've tossed around several potential solutions, but they all rely upon each
> > thread having it's own PID, which is apparently a quality of linuxthreads that
> > is in contention??
>
> Well, at least in my (in progress) patch to give all threads the same pid,
> I will be providing a second system call to get the task ID, which under a
> pure kernel-mode threads implementation like LinuxThreads will be unique
> to the thread. I don't know of anyone else working on the same thing, but
> if someone is, no comment on whether they will be doing the same.
>
I don't really understand why a kernel patch is needed to have a uniq
PID for a thread. I would have implemented a getpid() in the libpthread
(hiding the getpid() from libc), as well as a getppid().

The libpthread getpid() return value will be the PID of the thread manager,
and getppid() the PID of the parent of the first thread created. In order
to get the actual pid of the thread, then you will have to use __getpid().
The same mechanism would also be implemented for getppid().

I don't think that this may break anything (except for older programs using
getpid() with a wrong POSIX semantic), since __getpid() should not be used
in portable pthreaded programs; and the big advantage is to run on any
actual kernel with a getpid()/getppid() POSIX-semantics.

-Eric
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Web : http://www.ri.silicomp.com/~paire | Group SILICOMP - Research Institute
Email: eric.paire@ri.silicomp.com | 2, avenue de Vignate
Phone: +33 (0) 476 63 48 71 | F-38610 Gieres
Fax : +33 (0) 476 51 05 32 | FRANCE

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