COS 111, Fall 2000 - Problem Set 4

Solution set

Due by 5pm, Tuesday Oct. 17, 2000

Problem 1
Suppose that three values x, y, and z are stored in memory at locations 20, 21, and 22 respectively. Write a program in the machine code of the COS 111 processor that adds up these numbers and puts the sum into memory location 25.

Problem 2
A modern processor can execute 300 million instructions per second. If a person types 100 characters per second, how many instructions on average does the computer execute between two consecutive keystrokes? (In other words, how many instructions can the computer afford to execute in dealing with each keystroke?)

Problem 3
What does the following program (written in assembly language for the COS 111 processor) do?


start:
	SetPc start
	Halt

Problem 4
Can you think of a situation where the program from problem 3 would really be useful? If you can, explain what that situation is and why the program is useful in that situation. If you can't think of a situation where it would be useful, then do you think the assembler (the program that translates the assembly code program into machine code) should try to detect such programs and tell the programmer he/she made a mistake?

Problem 5
A well-known rule called "Moore's Law" (named for Gordon Moore, a founder of chip-maker Intel) says that processors double in speed about every eighteen months. (Remarkably, this rule has held true since about 1965, through about 23 doublings, or a speed increase of about ten million times.) If processors double in speed and software stays the same, then all programs should run about twice as fast now as they did in early 1999. But almost everybody says that computers seems to do things at about the same speed as they did in 1999. What reasons might explain why the expected speedup hasn't materialized? (Be creative, and give as many plausible guesses as you can think of. There's no single right answer to this question.)


Back to Schedule and Assignments