# Thread: Computer Science - Word Problem

1. Greetings,
I've just started taking a computer systems class, and although it wasn't a pre-requisite, my teacher is recommending that students take a programming course, specifically C++, prior to taking the computer systems class. The teacher said if we didn't, we would really struggle. I'm trying it out and I've encountered my first problem. I understand most of the solution given except for two aspects. If someone could please help me to understand those two aspects, it would help me greatly.

Word Problem:
Suppose a CPU is rated at 2.5GHz. what is the average length of time needed to execute one instruction?

Solution:
2.5GHz is 2.5 X 10exp9 instructions per second. That is 1/2.5 X 10exp9 = .4*10exp-9 or 400 picoseconds per per instruction.

1. Why is 1 being divided into 2.5
2. I don't get 400 picoseconds when I calculate 4*10exp-9  2.

3. 1. It's because the speed is 2.5 GHZ, and not 1 GHz. So you have to divide by 2.5
2. You have to calculate 0.4*10exp-9, not 4*10exp-9.

Does that help ?  4. 1. It's because the speed is 2.5 GHZ, and not 1 GHz. So you have to divide by 2.5
So the one that I am dividing in to 2.5, that is the 1 instruction?
2. You have to calculate 0.4*10exp-9, not 4*10exp-9.
So, 0.4*10exp-9...doesn't that equal .0000000004?  5. Hertz (Hz) is a unit of inverse time; how many cycles happen per unit time, in this case the second, so its unit is 1/s.

The inverse of frequency is the period, again usually in seconds. It says how long it takes for one cycle to complete.

The problem is giving you the frequency, but the answer it wants is the period, so you are figuring out: 1/ frequency = period.  6. Thank you so much for explaining the inversion of time. That totally helped me. I still just have one more question. I am seeing that 0.4X10exp-9 equals into nanoseconds. Im not understanding why further inversion is being done to translate it into picoseconds.  7. The nano prefix means 10-9. The pico prefix means 10-12.

What does 0.4 nanoseconds mean? Take your decimal place and shift it over 9 places: 0.000000000

Now put a .4 there. that means we have to shift one more 0.0000000000 (10 zeros) and place our 4: 0.00000000004

What does 400 picoseconds mean? Take your decimal place and shift it over 12 places: 0.000000000000
Now place your 400. But 400 is 4 * 102 so we have to shift two to the left 0.0000000000 (10 zeros) and place our 4: 0.00000000004

If you noticed, they are the same thing. Usually the convention is to stay within the 0-999 range of your powers of 3 and use that prefix, so saying 400 picoseconds is "nicer" than 0.4 nanoseconds, but the convention is broken all the time. People say that the speed of light is roughly 3 * 108 meters/second, and very rarely say 300 megameters/second.

So:

Convert as needed.  8. I finally understand the solution of the problem thanks to the explanation of inversion of time and converting nanoseconds to picoseconds. Thank you everyone : )  computer science 