CS439: Principles of Computer Systems
Homework 2, Part 1
Due: 9:45a Thursday, September 11, 2014 Part 1 of the
homeworks must be submitted electronically. Please refer to the
homework turnin instructions.
What are "privileged instructions"? Name three situations
in which privileged instructions are required.
From Anderson and Dahlin, Ch1 question 1:
Suppose a computer
system and all of its applications are completely bug free. Suppose
further that everyone in the world is completely honest and
trustworthy. In other words, we do not need to consider fault isolation.
- How should the operating system allocate the processor? Should
it give all of the processor to each application until it no longer
needs it? If there are multiple tasks ready to execute at the same
time, should it schedule the task with the least amount of work to do
or the most? Justify your answer.
You may assume a uniprocessor.
- How should the operating system allocate physical memory between
applications? What should happen if the set of applications does not
all fit in memory at the same time?
From Anderson and Dahlin, Ch1 question 2:
Now suppose the
computer system needs to support fault isolation. What hardware
and/or operating support do you think would be needed to protect an
application's data structure in memory from being corrupted by other
applications? Assume more than one application may reside in memory
at a time.
A typical hardware architecture provides an instruction called
return from interrupt, which is abbreviated by something like
rti. This instruction, which is usually only available while
the machine is running in kernel mode, switches the mode of operation
from kernel mode to user mode.
- Explain under what circumstances this instruction would be
used by the operating system.
- What happens if an application program executes
Given the following piece of code:
main(int argc, char** argv)
void forkThem(int n)
How many processes are created if the above piece of code is run?
What differentiates a program, an executable, and a process?