CS372H Spring 2011 Homework 11
(Some of these problems will be reviewing prior concepts, to help you review for the final.)
Problem 1
In class, we discussed the fact that, if messages can be lost, it is impossible
to devise an algorithm that guarantees that two nodes can agree to do the
same thing at the same time (the two generals problem).
However, weaker forms of agreement may be possible.
Suppose two nodes, A and B, communicate via messages and that the
probability of receiving any message that is sent is P (0 < P < 1 ). You need
not consider any other types of failures.
-
Is it possible for A and B to agree with certainty to perform some action (but
not necessarily perform it at the same time)? If not, explain why not. If so,
describe a protocol that provides this guarantee.
-
Is it possible for both nodes to agree to do the same thing at the same time
with >99.99999% certainty (e.g. guarantee that there is less than a 0.0000
1% risk that one or both will fail to make the appointment)? If not, explain
why not. If so, describe a protocol that provides this guarantee.
-
Suppose that in addition to lost messages, either A or B may crash at any
time and, once crashed, recover at some arbitrary time in the future. Is it
possible for A and B to agree with certainty to perform some action (but not
necessarily perform it at the same time)? If not, explain why not. If so,
describe a protocol that provides this guarantee
Problem 2
A system uses multi-partition allocation with
swapping. The size of main memory is 128K, and there are 4 programs running
with sizes 64K, 64K, 32K, and 16K respectively. Each program runs for 50msec,
and then requests an I/O operation that requires 20msec. A program can
be swapped at the rate of 8Kbyte/20msec. Compute the CPU utilization under
round-robin scheduling. Devise a better scheduling strategy and show it
has a better utilization.
Problem 3
In problem two, compute the CPU utilization if we:
-
replace the CPU by one that runs 10 times faster
-
double the size of main memory
Problem 4
Alice P. Hacker is a Head Guru in MacroHard, a
software company known for operating systems with very sorry quality. She
suggested a trick to reduce the pressure on the swap space. Instead of
swapping out pages that belong to code texts into the swap area, the operating
system could just take away the memory frames. If the code page is needed
later, it could be paged directly from its binary file. Her argument is
that the operating system will save time by not storing the code page into
the swap space, and will save space in the swap area. The code text exists
on disk anyway, and could be fetched from there. Would you approve of this
design? Why or why not?