Homework 14: Operating Systems and Processes
Due: 5/25 12:30pm
Name & Perm #:
Homework buddy (leave blank if you worked alone):
Reading: Chapters 3, 4, and 5 of Operating Systems: Three Easy Pieces (you can download them from the web page, also you can skip the "Homework" sections). Also, the chapters from the UNIX textbook (available from GauchoSpace).
1. \( 2 pts \)
In a brief sentence, describe the difference between a process and a program, as defined by Arpaci-Dusseaus.
2. \( 3 pts \)
In class, we discussed three objectives of an operating system. List them below:
Abstracting
__________________
Isolating
_______________
Managing
______________
3. \( 3 pts \)
Arpaci-Dusseaus describe a process being in one of 3 states at any point. Describe each of these states with your own words:
4. \( \)
The history of Unix as an OS (and then, the history of all Operating Systems, including those derived from Unix, such as Linux, Mac OS X, etc.) was heavily influenced by the choice of programming language in which Unix was first implemented.
(1 pts) What programming language was chosen for the first implementation of Unix?
(1 pts) Most other OS implementations, up to that point in time, had been written in what language?
(2 pts) According to the authors, as a direct result of these two facts (your answers to (a) and (b)), Unix had a distinct advantage over other OSes at the time. What was this advantage?
5. \( \)
In the Unix system, the “system call interface” provides entry points into … something.
(2 pts) In a single word or short phrase (no more than four words) name what the system call interface provides an entry point into.
(2 pts) Now, in a 2-3 sentences, describe what the phrase means. What is the “purpose” of the thing you named in part “a”?
6. \( \)
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?
(2 pts) What do you type to suspend the current running program?
(2 pts) What do you type to resume the suspended program?
7. \( \)
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 of kill
and when each might be useful.
(2 pts)
(2 pts)
8. \( \)
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.
(2 pts) fork
(2 pts) exec
(2 pts) parent
(2 pts) child
9. \( \)
The ps
command and the jobs
command both list processes. Write a few
words that distinguishes between the ways that they are used, that is:
(2 pts) What is a circumstance where
ps
is more appropriate thanjobs
?(2 pts) What is a circumstance where
jobs
is more appropriate thanps
?