Shevek,
> > 7. [wait for all processes to terminate? only last one?]
I tested yesterday. Waiting for all the process to terminate
doesn't hangs system anymore. :)
BUT: by an unknown reason, the flushing of the pipe is not correct
yet. The error seems to be in my algorithm, since 'man' (that make a
pipe to 'more') works perfectly... Maybe I forgot something in the
algorithm?
> This sounds ok. I presume that process 1 and process 2 are running
> simultaniously
Right.
> and are put to sleep when they ask for data that isn't
> there yet? If not, that is a problem.
It seemed that second process (reader) was waiting for data
forever... Process 1 (writer) allways have the data (since it reads data
from disk).
> Did you think of sending a wake-up signal to the process waiting for data
> when there is put data in the buffer after is was empty?
It is done.
> > Another question is: shouldn't shell wait for all processes to
> > terminate? Or just for the last process?
> I should say both
That's what I did yesterday. After the forks, I put a
for (i=0; i<2; i++) {
if ((wait(&status)==pid1) close(pipe_fd[0]);
else close(pipe_fd[1]);
}
> since the first can still receive input when the last
> died. But most of the time it doesn't matter, since when the last process
> dies, the first will recieve a "broken pipe" signal for any output it
> sends.
I thought that "broken pipe" was an error code set by kernel when
it tries to write to a pipe that has no readers... Interesting... I'll
take a look...
Thanks for you reply, Shevek!
Adriano Camargo Rodrigues da Cunha ([EMAIL PROTECTED])
Engenharia de Computacao - UNICAMP
http://www.adrpage.cjb.net http://if.you.dont.like.msx.usuck.com
* Runtime Error 6D at 417A:32CF: Incompetent User. *
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****