NEXT UP previous
Next: Answers

Exercises

  1. Write a function called mydup2() which provides the functionality of the dup2() system call but written using only dup().

  2. Devise and run an experiment to discover the size of a pipe in Linux.

  3. Write a simple program which creates a pipe and then executes a fork() call so that two independent processes are running. The two processes should then use the pipe to pass the contents of a large file from one process to the other.

  4. Rewrite the program from the previous question to use shared memory to pass the contents of the file between the two processes. What are the extra problems you encounter in doing it this way? Which of your programs would you expect to run faster, and which one does?

NEXT UP previous
Next: Answers