Re: fork and process timing issue

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 05/29/04


Date: Fri, 28 May 2004 21:17:30 -0400

In article <40B7D47E.8060802@foo>, Stephen <s@foo> wrote:

> Barry Margolin wrote:
> > In article <40B75D67.EFBCFAEC@cast-com.net>,
> > "Stephen L." <sdlnospamar@cast-com.net> wrote:
>
> [ snip ]
>
> >>
> >>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.
> >
>
> Yup, it is (relevant, IMHO). Unless he's putting the pid
> in a _file_ (or some more complex scheme), the following is TRUE ->
>
> Any shared memory segments attached to the calling process
> image will not be attached to the new process image (see
> shmop(2)).

I was assuming that the program he's exec'ing calls shmat() to access
the shared memory.

He said that his program used to work before he got faster hardware. So
obviously the stuff involving this array does what he wants. The only
thing that has changed is the timing, and that's not related to what the
applications do. For whatever reason, he wants the parent process to
perform certain actions before the child does some related actions, and
the solution to this is to use some method of signaling between the
processes: a semaphore, a pipe, etc.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • Problems accessing shared memory
    ... create or access the shared memory segment on a specific computer. ... The problem also appeared on a system using Windows 2003 server and Windows ... but we found a fix. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Reading code of a function?
    ... In the shared memory, there would be an array of function names, and the ... ADT could refer to an index in that array. ... and the function lookup is a direct array lookup rather than a ...
    (comp.unix.programmer)
  • Re: IPC:Shareable
    ... shared memory. ... that array as reference as value of the hash. ... It's best not to 'use' modules inside a sub (except for lowercase ... You cannot assign a ref to an IPC::Shareable tied hash. ...
    (comp.lang.perl.misc)
  • Re: Linked List in Shared Memory
    ... Although it requires a bit more work, it is still possible to implement a linked list and insert and delete items using an array. ... primitives (shared memory, pipes, mailslots etc). ... indexes bcse we need to delete the node add new node etc etc, ...
    (microsoft.public.vc.mfc)
  • Re: A shared library which attaches a shared segment - whats the right way??
    ... > The varibale which attaches the shared memory segment using 'shmat' is ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.aix)