Assignment (Due Wednesday 25 October at 11:00am by email. Please submit the text of your answers and the rationale you used in generating those answers, each numbered appropriately.)
For the following, think about the ways we have used files in the past and contrast that with what you have just learned about the type of special file called a pipe. For some of the questions below, you need only spend some time thinking. For others you should experiment with synchronizedProcessFan.c and/or other examples, tweaking them as needed to answer each question for yourself. Not one of these questions is tricky. However, they will require you to do a very small amount of exploratory programming.
- What property of pipes must differ from that of regular files with regard to read operations and therefore enables their use for tasks such as synchronization?
- Do all processes read the result of one write operation or must there be a separate write for every read operation? If the later, does a single read call retrieve everything written by a single write call?
- Can multiple processes write to the same pipe?
- Can multiple processes writing to the same pipe step on one another?
- With regard to their basic structure, what property of pipes differs from that of regular files and makes it possible to use them in inter-process communication such as that in synchronizedProcessFan.c in which the parent writes messages that are read by children.
- Does the pipe in synchronizedProcessFan.c function more like a broadcast medium such as FM radio or more like a point-to-point messaging system such as how we typically think of a telephone call?
|