クロック周波数 2 GHz のプロセッサにおいて一つの命令が 5 クロックで実行できるとき, 1 命令の実行に必要な時間は何ナノ秒か。
平成22年度 秋期 ITパスポート試験 問57
This question's explanation and your answers so far.
問 57
Incorrectア
0.1 nanoseconds is the value you get by dividing the clock cycle time of 0.5 nanoseconds by the 5 clocks (0.5 ÷ 5 = 0.1). The number of clocks works to increase the time required, so dividing where you should multiply is the mistake. If one instruction takes 5 clocks, it can never be shorter than a single clock.
Incorrectイ
0.5 nanoseconds is exactly the time of one clock (the clock cycle time) itself. Computing 1 ÷ 2×10^9 = 0.5 nanoseconds from 2 GHz is correct, but the calculation stops there and does not multiply by the condition that one instruction requires 5 clocks. What the question asks for is the execution time of one instruction, not of one clock.
- ウ
正解 The correct answer is ウ (2.5). First, find the time required for one clock (the clock cycle time). A clock frequency of 2 GHz means that the clock ticks 2×10^9 times per second, so the clock cycle time = 1 ÷ 2×10^9 = 0.5×10^-9 seconds, that is, 0.5 nanoseconds. Next, since one instruction can be executed in 5 clocks, the execution time of one instruction = clock cycle time × number of clocks = 0.5 nanoseconds × 5 = 2.5 nanoseconds. Getting a feel for the units makes this fast: at 1 GHz the clock cycle time is exactly 1 nanosecond, so 2 GHz is half of that, 0.5 nanoseconds, and five of those give 2.5 nanoseconds, which you can work out in your head.
Incorrectエ
10.0 nanoseconds corresponds to the mistake of simply multiplying the numeric value 2 from the frequency by the 5 clocks to get 2 × 5 = 10, or to mistaking the clock cycle time for 2 nanoseconds and computing 2 × 5 = 10. 2 GHz is the number of clocks per second, not a time, so the numeric value of the frequency must not be used directly as a time. To obtain a time, you must always take the reciprocal (1 ÷ frequency).
- Clock cycle time = 1 ÷ clock frequency. Frequency and time are reciprocals of each other, so convert them like 1 GHz → 1 nanosecond, 2 GHz → 0.5 nanoseconds, 500 MHz → 2 nanoseconds (1 GHz = 10^9 Hz, 1 nanosecond = 10^-9 seconds).
- Execution time of one instruction = clock cycle time × number of clocks per instruction. Grasp this relationship: the higher the frequency, the shorter the clock cycle time, and the faster the same instruction can be executed.