*BSD News Article 79888


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!newsfeed.internetmci.com!news-in2.uu.net!jaring.my!cs.usm.my!network4.cs.usm.my!cyfok
From: cyfok@network4.cs.usm.my (Chee-Youn Fok)
Newsgroups: comp.unix.bsd.misc
Subject: Programming Ques. - Fork and Wait
Date: 4 Oct 1996 10:33:02 GMT
Organization: School of Computer Science, USM.
Lines: 34
Message-ID: <532p4u$al0@cssun.cs.usm.my>
NNTP-Posting-Host: network4.cs.usm.my
X-Newsreader: TIN [version 1.2 PL2]

Hi all,
  Sorry, it's programming question again. Currently I am writing a program
which needs to use Fork and Wait function in linux to test how many
child proseses can Unix handels in parallel. It's like that, I have one
parent proses and need to create (fork out) a child proses, that child
proses
will then create (fork out again ) another child proses, this will go on
until 3 child proseses will be created.

  Then I will input one number to the last child proses and that child
proses will do the square root for it and output the answer to the
previous child proses. This will go on until the first parent get the
output from the first child proses and it will do the square root for that
number and output to the screen, then the prose terminate.
  It looks so confuse, I think a diagram will explain better :

  parent ------> child proses ------> child proses ------> child proses
       create (fork)        create (fork)        create (fork)


              answer1               answer              answer3
  child proses -----> child proses ------> child proses ----> parent proses
  (square root        (square root        (square root        (square root
   a number)           the answer1)        the answer2)        the answer3)

Thanks.

--
regards,
Chee-Youn Fok 
Network Research Group, University Science Malaysia  
Tel    : (604)6577888 Ext 2488
e-mail :cyfok@network4.cs.usm.my   
WWW    :http://network4.cs.usm.my/~cyfok/