• Control flow during a restart:
    • When the a primitive restarts, it closes any pipes it has open (this is done in the close() method).
    • As the pipes are closed, they get marked as needing a restart (this is done automatically).
    • As subsequent primitives reach the point in the pipe where the restart was called, the read(..) method returns end-of-file (EOF), numRead<0, and marks the primitive for a restart.
    • These primitives restart and trigger any additional restarts "down the line." The result is like a waterfall with subsequent primitives restarting as needed.
    Click image for larger view.