Re: Slow pthread_create() under high load

From: Richard Gooch (rgooch@ras.ucalgary.ca)
Date: Tue Mar 28 2000 - 14:34:25 EST


Linus Torvalds writes:
> In article <20000328014126.A2740@xman.org>,
> Christopher Smith <x@xman.org> wrote:
> >
> >IMHO, at least sharing PIDs would be a useful thing. Signal queues
> >would be nice, but there are other ways to deal with that.
>
> I don't understand the pid sharing argument. Just cache the pid of the
> parent process, you're done.
>
> Many UNIX implementations do something like this in their getpid()
> routine anyway:
>
> static pid_t mypid = 0;
>
> pid_t getpid(void)
> {
> if (!mypid)
> mypid = __getpid();
> return mypid;
> }

Hm. Is it actually this easy? What if I do:
        getpid(3);
        fork(2);
                        CHILD
                        getpid(3);

You would need to wrap up fork(2) as well, to clear the cached value
for the child.

And what about getppid(2)? This one is tricky, because it can actually
change.

                                Regards,

                                        Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:22 EST