From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5cbd5cd6660623ce20969c97e515457d@9netics.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] trying to understand how fork/pipe a filtering program Date: Fri, 1 Sep 2006 11:42:19 -0700 From: Skip Tavakkolian <9nut@9netics.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: add95a1c-ead1-11e9-9d60-3106f5b1d025 >> or rendezvous > > i'm not sure rendezvous is an option here (you've no control over the child > process after execing it), and even if you did (e.g. by doing the wait in another > process), it still doesn't get around the fact that > when the data's large you need to be reading it at the same time that > the child is writing it - there's no appropriate time to rendezvous. right. Axel's question was about running resample in parallel. as to why it works with a sleep, it's all stated in pipe(3). if you give enough time to resample, it gets the first read on the pipe, then parent gets the second read - which will come from a write from resample. i was thinking switch (fork()) { child: while (1) { rendezvous(0,0); if (read()<0)exit(); rendezvous(1,1); write(); } parent: while (more) { rendezvous(0,1); write(); rendezvous(1,0); read(); } } which isn't possible with an uncooperative program, and is a little dangerous. wouldn't ioproc(2) be a better solution for this class of problems?