Re: fork and process timing issue
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 05/28/04
- Next message: Jem Berkes: "Re: fork and process timing issue"
- Previous message: Stephen L.: "Re: fork and process timing issue"
- In reply to: Stephen L.: "Re: fork and process timing issue"
- Next in thread: Stephen: "Re: fork and process timing issue"
- Reply: Stephen: "Re: fork and process timing issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 May 2004 12:08:32 -0400
In article <40B75D67.EFBCFAEC@cast-com.net>,
"Stephen L." <sdlnospamar@cast-com.net> wrote:
> pat saunders wrote:
> >
> > Hi,
> > I am using c , unix (solaris 8) on a sun box, although question is a
> > general
> > one.
> > If I have a process A that forks() and execl() a process B.
> >
> > pid = fork()
> > switch (pid)
> > case 0:
> > execl (process B)
> > case -1:
> > error
> > default:
> > store pid in array
> > continue with process A.
> >
> > This worked fine until upgraded h/w to a faster machine.
> > Now, process A executes process B and process B executes alot of code
> > before
> > it tries to access its PID which process A has not had a chance to store
> > due to
> > no further time slices.
> > My question is to avoid semphores etc, What commands can be used to force
> > the
> > processor to hand back a time slice to process A.
> > Is sleep() the best option in process B.
> > Ta
> > Pat
>
> Huh? How can an `execv()'d program (process "B")
> access memory in it's parent (process "A")?
>
> If "A" stores the child's PID in an array, how
> is "B" seeing this value? There's something
> missing in you problem description.
The array is probably in a shared memory segment. This detail isn't
really relevant to the OP's question.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Next message: Jem Berkes: "Re: fork and process timing issue"
- Previous message: Stephen L.: "Re: fork and process timing issue"
- In reply to: Stephen L.: "Re: fork and process timing issue"
- Next in thread: Stephen: "Re: fork and process timing issue"
- Reply: Stephen: "Re: fork and process timing issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]