*BSD News Article 80117


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.erols.net!news.mathworks.com!fu-berlin.de!informatik.tu-muenchen.de!Germany.EU.net!Dortmund.Germany.EU.net!interface-business.de!usenet
From: j@ida.interface-business.de (J Wunsch)
Newsgroups: comp.unix.bsd.misc
Subject: Re: Programming Ques. - Fork and Wait
Date: 7 Oct 1996 09:30:33 GMT
Organization: interface business GmbH, Dresden
Lines: 23
Message-ID: <53aijp$3ko@innocence.interface-business.de>
References: <532p4u$al0@cssun.cs.usm.my> <5357bg$lff@cssun.cs.usm.my>
Reply-To: joerg_wunsch@interface-business.de (Joerg Wunsch)
NNTP-Posting-Host: ida.interface-business.de
X-Newsreader: knews 0.9.6
X-Phone: +49-351-31809-14
X-Fax: +49-351-3361187
X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F  93 21 E0 7D F9 12 D6 4E

cyfok@network4.cs.usm.my (Chee-Youn Fok) wrote:

>   Sorry for my previous posting which didn't come with the question.
> ACtually I would like to ask whether is it possible to implement the
> algorithm ? Since what I heard is that we can't pass value to the child
> process which is created by the parent process.

Of course, you can pass a value down to the child.  If you've got the
value ready before fork()ing, the child will (of course) inherit it.
Otherwise, you gotta use one of the various IPC methods.  For BSD-like
systems, you can e.g. use mmap() to create a shared memory region
between all the processes.  You can certainly also work it out with
pipes, but i think this would considerably slow down the matter.
Since your initial desire was some sort of a benchmark, this will
certainly affect your result.

Passing up a value from the child to its parent, however, always
requires IPC.

-- 
J"org Wunsch					       Unix support engineer
joerg_wunsch@interface-business.de       http://www.interface-business.de/~j