Question about the cycle unit

25 Views Asked by At

I am trying to understand the cycle unit in the following context:

Program A runs for 200 cycles
Program A runs for 350 cycles

cycle is defined as the execution time * clock frequency i.e seconds*hz and hz is defined as 1 cycle per second, but what is cycle? which program is faster?

1

There are 1 best solutions below

3
On

The CPU performs its computational steps in sync with an oscillator (a "clock") that oscillates in the mega and gigahertz range, depending on make and model and even user configuration ("overclocking"). A single oscillation of that clock is called a cycle. Many operations can be performed in a single cycle (e.g., add contents of one register to another register), other operations take several cycles by complexity (e.g., multiply two registers) or due to slow hardware involved (e.g., write from register to RAM). In modern CPUs, many operations are highly parallelized so that cycle-counting is not that trivial.

With the data you gave in your post, the first program takes less time to complete than the second, at least if both are executed by computerers with the same clock frequencies.