Description:
Please refer to 8.10, page 299.
This exercise asks you to modify
program 8.16
such that it does asynchrous read and asynchrouns write.
The main thread can be just reading from stdin, and writing to stdout,
until EOF.
A possible scenario:
$ ./a.out infile outfile <----- copy infile to outfile
hello i'm klim with async read and async write
hello i'm klim <---- read stdin and echo it to stdout ...
...
...
[Copy completed] <------ when the copy is completed, show something
.. to screen
..
^D
$
In order to simulate a slow device, the
periodicasterisk (program 9.7) has been modified such that it will
read a char from stdin and write it to stdout
in argv[1] times per second.
Through FIFO, it can be cooperated with this exercise as follows:
1st shell:
$ ./a.out infile FIFO <----- the contents of infile is sent to FIFO
hello klim
hello klim
.......
2nd shell:
$ ./periodicchars 12 < FIFO
....... <---- the contents of infile is shown here
in the rate of 12 chars per second
deadline: 2010/May/27, 00:05 am