[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pfork()



On 17 Aug 1998, Andreas Schwab wrote:

> Jo Even Skarstein <joska@nuts.edu> writes:
> 
> |> I guess this is a stupid question, but if it's so that Pfork gives the new
> |> process a *copy* of the DATA and BSS segments, why doesn't the
> |> AES/VDI-bindings get a new copy of their global arrays?
> 
> They do, but the AES/VDI still does not know anything about the split.
> Thus they will behave as if the two forked processes are one and the same.

I'm afraid I don't understand this. If the new process indeed has new
AES/VDI global arrays, *and* the bindings know about them, how can AES/VDI
be confused? The bindings pass pointers to their global arrays in d1
(IIRC), so when you create a new application in the thread with
appl_init() then everything should be ok? But since it's not (in my tests
the two threads use the same arrays, hence confusing the AES), I guess
I've totally misunderstood this.

And one other thing about Pfork, when the child exits it leaves a zombie.
What should I do to get rid of this? My code looks something like this:

 if (!Pfork())
 {
   /* Enter child */

   do some stuff

   Pterm0();
 }


/*
** Jo Even Skarstein   http://www.stud.ntnu.no/~josk/
**
**   beer - maria mckee - atari falcon - babylon 5
*/