CS560 Lab #6

  • Jim Plank
  • Rich Wolski

  • Lab 6 -- Pipes

    The explanation in this lab is simple. Implement the system calls dup(), dup2() and pipe(), and make sure that close() works correctly with these.

    When you're done you should be able to use jsh and connect processes with pipes.


    Compilation and Linking

    Do everything as in lab 5. The simulator has not changed.

    Subleties

    You'll have to deal with certain events correctly. For example, if you write to a pipe that has no read end, your process should die quietly (i.e. we're not going to deal with catching SIGPIPE signals). If you are blocked writing to a pipe and the read end goes away, your process should die quietly. If you are blocked reading from a pipe and the write end goes away, the read() system call should return zero. If you have written bytes to a pipe, but they never get read, that's ok -- make sure it isn't a problem (i.e. a memory leak).

    We'd also like the semantics of pipe reading/writing to be like Unix. For example, if one process does write(p[1], buf, 10) and the process on the other side of the pipe does read(p[0], buf, 20), the read() call will return with 10 bytes.


    As usual

    There is a WHAT_DR_PLANK_DID file, and a separate helper file (james.html) from James Calloway, who TA'd this class in the spring of 2000. These notes are a little sketchier than the previous notes, but by now you should be getting better at this kind of programming.