lkml.org 
[lkml]   [2000]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Slow pthread_create() under high load
On Tue, Mar 28, 2000 at 12:34:25PM -0700, Richard Gooch wrote:
> 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.

You need to wrap fork anyways to run pthread_atfork routines.

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

On the clone, with the right flags, I think this is inherited - the new
process is a sister not a child.


--
---------------------------------------------------------
Victor Yodaiken
FSMLabs: www.fsmlabs.com www.rtlinux.com
FSMLabs is a servicemark and a service of
VJY Associates L.L.C, New Mexico.


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

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.102 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site