1 |
h17 |
CS32 F19 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section 9am, 10am, 11am, 12pm |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h17: Processes
ready? | assigned | due | points |
---|---|---|---|
true | Tue 11/26 02:00PM | Thu 12/05 02:00PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the lowest scores (if you have zeros, those are the lowest scores.)
Reading: Processes, CS32 Reader (p. 117 - 146)
- (10 pts) Fill in the information in the header. The following are required to get the 10 "participation" points.
- Filling in your name and umail address.
Also: For paper submission PLEASE submit on ONE SHEET OF PAPER, double-sided if at all possible. If you must submit on two printed sheets write name on BOTH sheets and no staples, paperclips, or folded corners.
- Filling in your name and umail address.
- (4 pts) Fill in the blanks, using the definition in the reading. Both are single words—the first starts with p, and the second starts with e.
A process is a __________________________ in __________________________
- If you want to "suspend" a program that is running in a shell, in order to get to the shell prompt and do a few commands, then resume that program, what can you do?
- (4 pts) What do you type to suspend the current running program?
- (4 pts) What do you type to resume the suspended program?
- (4 pts) What do you type to suspend the current running program?
- The command
kill
is used to, as the name would suggest, manually end processes.kill
's primary function is to provide the user with control over processes that are running in the background and thus only accessible by a PID (process ID).kill
features varying levels of ability to end process. Why is this fine-tuning useful? Answer the question by succinctly describing at least two different modes ofkill
and when each might be useful.- (5 pts)
- (5 pts)
- (5 pts)
- Suppose you have a hello.cpp file that you've compiled into a binary called ./hello. As you know, you can run this with the steps shown below:
-bash-4.2$ ./hello Hello, World -bash-4.2$
In the steps shown, under the hood, somehow something called "fork and "exec" are involved in getting this program to actually start running. And there is some kind of "parent" and "child", somehow involved. For each of the following, describe its role, relating it to these concepts. Be brief but be just specific enough that the grader has NO DOUBT that you've read and understood the discussion of these concepts in the reading, and how each of them relates to running a ./hello program.
- (3 pts) fork
- (3 pts) exec
- (3 pts) parent
- (3 pts) child
- (3 pts) fork
- The
ps
command and thejobs
command both list processes. Write a few words that distinguishes between the ways that they are used, that is:- (3 pts) What is a circumstance where
ps
is more appropriate thanjobs
? - (3 pts) What is a circumstance where
jobs
is more appropriate thanps
?
- (3 pts) What is a circumstance where