COMP150 Assignment 3

Two boys are playing on either side of a high fence. One of the boys, named
Apple-server, has a beautiful apple tree loaded with delicious apples growing on his side
of the fence; he is happy to supply apples to the other boy whenever needed. The other
boy, named Apple-eater, loves to eat apples but has none. In fact, he must eat his apples at
a fixed rate (an apple a day keeps the doctor away). If he eats them faster than that rate,
he will get sick. If he eats them slower, he will suffer malnutrition. Neither boy
can talk, and so the problem is to get apples from Apple-server to Apple-eater at the correct
rate.

Assume that there is an alarm clock sitting on top of the fence and that the clock
can have multiple alarm settings. How can the clock be used to solve the problem? Draw a timing
diagram to illustrate the solution.

Now assume that there is no alarm clock. Instead Apple-eater has a flag that he
can wave whenever he needs an apple. Suggest a new solution. Would it be helpful for Apple-server
also to have a flag? If so, incorporate this into the solution. Discuss the drawbacks of this
approach.

Now take away the flag and assume the existence of a long piece of string. Suggest a solution that
is supperior to that of (b) using the string.

To use a computer for multimedia (moving video and sound), it is important to maximize the
efficiency of the I/O. Assume that the blocks of a movie are stored consecutively on a CD-ROM. Describe the steps
used to retrieve the blocks for use by the movie display software. Discuss ways in which you could optimize the performance of the
I/O transfer