Sharing the entire data segment between tasks

D Venkatrangan matrix!venkat at uunet.uu.net
Thu Nov 1 11:19:52 AEST 1990


In article <1990Oct7.225628.1295 at rice.edu> adimail!george at uunet.uu.net (George Pearson) writes:

>the parent's data and use it in the computation.  This is perfect except
>that because of "copy-on-write", the child cannot modify even a single
>variable without creating duplicate pages of data.  Results cannot simply
>be placed into the data because the parent process will never see them.
>The problem here seems to be how to get the entire data area to be
>MAP_SHARED across the fork.

Use shared memory.  Also, use vfork() instead of fork() and follow it
immediately with the exec of the child.  Pass the shared memory ID from
parent to child as a command line arg in the exec call.  In the child, map
the shared memory ID to a virtual memory address using the shmat() call.
If parent has stored pointers to locations within the shared memory you
should try to map it to the same virtual memory address as in the parent.

D. Venkatrangan
Matrix Computer Systems, Inc.           7 1/2 Harris Rd, Nashua, NH 03062
suneast!venkat   uunet!matrix!venkat    (603) 888-7790



More information about the Comp.sys.sun mailing list