CS360 Final Exam: December 12, 2000. Question 1
Suppose we execute the following from the shell:
UNIX> sort < f1 | head -5 | cat -n
For each question below, you are to answer what happens to the
given process in terms of how it exits.
You are to answer from the choices below.
a. |
read() returns 0, and it exits instantly. |
b. |
read() returns 0, it does some processing,
writes output and exits normally. |
c. |
It exits because it receives SIGPIPE. |
d. |
It exits because it receives SIGSEGV. |
e. |
It exits normally, even though read()
has not returned zero. |
f. |
It exits before making the execvp() call. |
g. |
It exits because the execvp() call fails. |
h. |
None of the above. |
|
For parts i-iii, suppose f1 is a three line file.
Part i: What happens to the sort process?
Part ii: What happens to the head process?
Part iii: What happens to the cat process?
For parts iv-vi, suppose f1 is a 100,000 line file.
Part iv: What happens to the sort process?
Part v: What happens to the head process?
Part vi: What happens to the cat process?
For parts vii-ix, suppose f1 does not exist.
Part vii: What happens to the sort process?
Part viii: What happens to the head process?
Part ix: What happens to the cat process?
For parts x-xii, suppose the program cat
does not exist, and f1 is a one line file.
Part x: What happens to the sort process?
Part xi: What happens to the head process?
Part xii: What happens to the cat process?