* read and reply using pipes.
* Process forks and exchanges messages
* over a pipe in a request-response fashion.
int fd
[2], fd2
[2], msgsize
;
printf("usage: %s iterations message-size\n", argv
[0]);
if (msgsize
> sizeof (buf
) || msgsize
<= 0) {
printf("%s: Bad message size.\n", *argv
);
for (i
= 0; i
< iter
; i
++) {
read(fd
[0], buf
, msgsize
);
write(fd2
[1], buf
, msgsize
);
for (i
= 0; i
< iter
; i
++) {
write(fd
[1], buf
, msgsize
);
read(fd2
[0], buf
, msgsize
);