From: Skip Tavakkolian <9nut@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 [thread overview]
Message-ID: <5cbd5cd6660623ce20969c97e515457d@9netics.com> (raw)
In-Reply-To: <adfc0937509ce088ce43fee203924d17@vitanuova.com>
>> 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?
next prev parent reply other threads:[~2006-09-01 18:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 22:46 Axel Belinfante
2006-08-30 23:05 ` geoff
2006-08-31 16:26 ` "Nils O. Selåsdal"
2006-08-31 19:55 ` Axel Belinfante
2006-08-31 20:15 ` rog
2006-08-31 20:24 ` Axel Belinfante
2006-08-31 20:24 ` rog
2006-08-31 20:45 ` Axel Belinfante
2006-09-01 3:43 ` geoff
2006-09-01 10:57 ` rog
2006-09-01 14:35 ` rog
2006-09-01 15:33 ` Skip Tavakkolian
2006-09-01 15:59 ` rog
2006-09-01 18:42 ` Skip Tavakkolian [this message]
2006-09-03 19:09 ` Axel Belinfante
2006-09-04 14:52 ` Gorka guardiola
2006-09-04 20:50 ` Gorka guardiola
2006-09-04 19:26 ` Skip Tavakkolian
2006-09-04 20:25 ` Francisco J Ballesteros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5cbd5cd6660623ce20969c97e515457d@9netics.com \
--to=9nut@9netics.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).