HW 1
HW 1
Graham Greving
[email protected]
Ch 1 # 6, 7, 13, 14, 25
6. There are several design goals in building an operating system, for example:
resource utilization, timeliness, robustness and so on. Give an example of two
design goals that may contradict one another.
All of the above. Except maybe read the time-of-day clock, I'm not sure about
that one.
25. To a programmer, a system call looks like any other call to a library
procedure. Is it important that a programmer know which library procedures result
in system calls? Under what circumstances and why?
Ch 2 # 1, 4, 11, 26, 36
1. In Fig. 2-2 [page 90], three process states are shown. In theory, with three
states, there could be six transitions, two out of each state. However, only four
transitions are shown. Are there any circumstances in which either or both of one
of the missing transitions might occur?
This is to preserve the state of the running program so it cannot "mess up"
any of the vital OS memory, and the OS cannot "mess up" any of the programs memory.
It also lets the OS execute more than one process at the /same time.
11. Why would a thread ever voluntarily give up the CPU by calling thread_yield?
After all, since there is no periodic clock interrupt, it may never get the CPU
back.
26. Show how counting semaphores (i.e., semaphores that can hold an arbitrary
value) can be implemented using only binary semaphores and ordinary machine
instructions.
mutex_unlock:
MOVE MUTEX, #0
RET
mutex m; // mutex
int i; // counting semaphore
36. Five jobs are waiting to be run. Their expected run times are 9,6,3,5, and X.
In what order should they run to minimize average response time? (Your answer will
depend on X)
It depends on the system and the scheduling algorithm being used. If this
were a batch system, then shortest-job-first algorithm produces the minimun
response time. In which case, depending on X, they would be run:
3,5,6,9
With X either at the front, end or in the middle somwhere depending on it's
runtime.
If the system were interactive, different algorithms could be used, most of
which aren't dependent on expected runtime, because in an interactive system that's
very hard to determine.