# What is Clock Cycle? (Explained)

## What is Clock Cycle?

A clock cycle is the measurement of time between two pulses of an oscillator, and in a computer processor, it is this measure that determines the speed of its operation.

Technically, a clock cycle indicates one increment of the Central Processing Unit or CPU clock while executing the smallest unit of processing activity. It is calculated by the time interval or duration of the electronic pulses sent or used for it.

### KEY TAKEAWAYS

• Clock cycle is basically the measurement of the electronic pulses of the CPU represented in Hertz or Megahertz and in an arrangement of 0 and 1 input.
• This cycle helps in figuring out the CPU speed because it is considered the fundamental unit of measurement for how fast the computer processor can carry out a given instruction.
• The common and basic activities performed during a clock cycle are fetch, load, store, jump, access the memory and write on it.
• The clock pulses are sent to all the gates of the processor with respect to high and low active, positive and negative edges.
• The higher the clock cycle or number of pulses in a second, the faster the information will be processed by the CPU.

## Understanding Clock Cycle A clock cycle, also referred to simply as cycle signifies the electronic pulse of the CPU.

The clock cycle is basically the flow of 0s and 1s between the gates as inputs and outputs.

The oscillator inputs are typically used to produce a continuous stream of 1s and 0s for the processor.

It is the standard of reference input to the elements of the processor at a standard speed.

It is also referred to as the synchronizer because the other instructions are carried out with reference to the clock cycle.

Depending on the type of CPU in question, it can carry out one or more instructions in one clock cycle.

In every clock cycle, the common activities performed by the CPU are:

• Fetch
• Jump and
• Store.

Some other operations performed by the CPU during a clock cycle are accessing the memory and writing data on it.

Typically, during each clock cycle, the processor of the computer can only perform the basic operations or carry out simple commands, which is why they need multiple clock cycles.

Earlier, the processors were slow and were able to handle only a single instruction in one clock cycle.

However, over time, with the improvement in design and technology, the modern processors can handle several instructions in each cycle.

Ideally, the higher the number of pulses in a second, or the clock cycle, the faster the CPU will be in processing information.

Like the CPU clock speed, a clock cycle is also represented in Hertz or Megahertz.

Read Also:  What is Max Clock Speed in Processor? (Explained)

For example, a 4 GHz CPU means that it will be able to handle as many as 4,000,000,000 clock cycles in one second.

The clock pulses are sent to all the gates of the processor with respect to different references for the regular time period based on the design such as:

• Positive edge
• Negative edge
• High active and
• Low active.

With respect to the clock cycles of a processor, the instructions received by it are decoded to either a 0 or a 1.

This is normally based on different types and aspects of the elements or logic gates of the processor such as:

• The operands
• The opcodes and
• The hex values.

Therefore, in short, the clock cycle, also known as clock tick, is basically the input of the oscillators, which represents the speed of executing the instructions. ## How Long is a Clock Cycle?

Ideally, a clock cycle is 1/ (1*10^6 cycles/sec) which can also be represented as 1/1*1/ (10^6 cycles/sec). The length of a clock cycle is usually determined by dividing the clock speed into 1.

Mathematically, the clock cycle time is the reciprocal of the clock frequency.

For example, if a processor has an operating speed of 1 GHz, the clock cycle time will be 1.0 ns, and if it is a 4 GHz processor, then the clock cycle time will be 0.25 ns.

The clock cycle of a CPU can be calculated by using the following formula:

CPU clock cycles = Instruction count x Cycles per Instruction or CPI.

Therefore, if a CPU is running a program and executing 10,000,000 instructions at an average of 2.5 cycles per instruction and at a CPU clock rate of 200 MHz or 5×10-9 seconds, the clock cycle will be: 10,000,000 x 2.5 x 5×10-9 = 0.125 seconds.

## What Affects Clock Cycle Time?

The two most significant factors that will affect the clock cycle time are the complexity of the instructions carried out in a single clock cycle and the circuit technology.

However, different elements of the equation for clock cycle time can be affected by different factors in different ways. Some of these factors are:

One or more of these factors may affect the different parameters of the clock cycle equation. For example:

• The instruction count is affected by the compiler, the program used and the ISA
• The average CPI is affected by the compiler, the program used, the ISA and the CPU organization and
• The clock cycle is affected by the CPU organization technology such as VLSI or Very large Scale Instruction.

The performance equation on the whole depends on the time units which need to be changed on both sides of the equation.

The instruction count and CPI may also be affected by several other significant factors as follows:

• Computer architecture: The computer architecture can decrease the instruction count with the addition of more powerful instructions to the set. This may increase the clock time or CPI or both at the same time.
• Transistor size: The clock time is also dependent on the complexity of the work as well as the speed and size of the transistor. If the size of the transistor decreases, it will lower the clock time.
• Power consumption: When the clock time is reduced, there will be an increase in the power consumption by the CPU, which will, in turn, generate more heat.
Read Also:  Why is CPU Important for Gaming? (6 Reasons)

On the other hand, computer architecture can lower the CPI by utilizing more parallelism at the instruction level. If this increases the complexity of the instructions, it will simultaneously increase the CPI.

And, the power of the instruction set may affect its count.

## How Are Pipeline Clock Cycles Calculated?

The pipeline clock cycles are calculated based on the form of the instruction pipelining and parallelism, called the instruction level parallelism, where several instructions are executed at the same time.

Several performance measures are also taken into consideration such as efficiency, speed, and throughput.

The pipeline clock cycles can be different for different conditions and scenarios. A few examples will make things clear.

Example 1:

For a 4-stage pipeline where the delay of stages are 60, 50, 90 and 80 ns and the delay caused by each register or latch delay is 10 ns, the pipeline cycle time will be calculated by the formula:

Cycle time = Maximum delay in due to any stage + Delay due to its register.

Therefore, in the above example, it will be:-

Max {60, 50, 90, 80} + 10 ns = 90 ns + 10 ns = 100 ns.

Example 2:

For a 4-stage pipeline where the delay of stages are 150, 120, 160 and 140 ns and the delay caused by each register or latch delay is 5 ns, the pipeline cycle time taken to process a thousand data items will be calculated by the formula:

Cycle time = Time taken for first data item + Time taken for the remaining 999 data items.

Therefore, in the above example, it will be:-

1 x 4 clock cycles + 999 x 1 clock cycle = 4 x cycle time + 999 x cycle time = 4 x 165 ns + 999 x 165 ns = 660 ns + 164835 ns = 165495 ns = 165.5 μs.

Example 3:

Based on the clock frequency, the clock cycle time of a pipelined processor is calculated as the reciprocal of the frequency.

For a processor with a clock frequency of 2 Gigahertz, it will, therefore, be 1 / (2 gigahertz) = 1/ (2 x 109 hertz) = 0.5 ns

And if there are no stalls within the pipeline, each instruction will be carried out in each clock cycle.

## How Many Ticks Are There in a Clock Cycle?

Ideally, in a personal computer, the clock tick indicates the main system clock in general. This means that, if the CPU runs at 66 MHz, there will be as many as 66 million clock ticks every second.

In simple words, however, when you consider the computer clock speed, a single Hertz is equivalent to one tick per second.

It will, however, be determined by the OS internal counter, which indicates the arbitrary unit for calculating the internal system time.

This is actually the same counter from which the current date and time used by different functions are determined.

Read Also:  What is ARM Processor? Architecture, Uses, Example & More

The number of milliseconds a clock tick would represent would largely depend on the operating system, and it may even vary depending on the installations.

You will need to use the mechanisms of the specific operating system in question in order to convert the clock ticks into seconds.

For example:

• On Microsoft Windows, there will be about 10000 clock ticks in a millisecond and
• On Linux, this number can be obtained using the command sysconf (_SC_CLK_TCK).

Usually, a processor with a frequency of 100 MHz the number of clock ticks will be 100,000,000 per second.

These clock ticks of a processor which are created and managed by the clock generator, may even stop under a few specific conditions such as:

• When it has nothing to do and stops working
• When it goes to the save power mode while the computer services an I/O request
• When hyperthreading feature is enabled so that the performance monitoring counters are powered down and
• When it goes into sleep mode.

During these particular times, the number of clock ticks will be different and low.

## How Many Clock Cycles are Required to Perform a Basic Operation?

Ideally, only one clock cycle is required to perform a single basic operation. In fact, this is what the earlier computer processors were capable of handling.

This basic operation may involve moving a byte from one memory location to another within the computer.

However, the number may vary if the process involves more than one operation, even if it is a basic fetch and decode operation.

For example, in a fetch and decode operation, the processor may need two cycles per word.

On the other hand, for other simple and basic instructions that do not need any parallelism at the instruction level, a processor may take as many as four clock cycles to carry out an instruction, and even more at times.

In general, it is one cycle for each simple operation required by the CPU to carry out an instruction, whether it is loop iteration, pipelining, or overlapping execution of the instructions.

## What is a Clock Cycle in a Pipeline?

The clock cycle in a pipeline refers to the time that typically contains the register and the longest hardware unit.

In a pipelined architecture, several instructions are carried out in parallel.

When one instruction is completed, one instruction comes out in each clock cycle.

Ideally, this means that each remaining instruction takes one single clock cycle.

## Conclusion

A clock cycle is a measurement that helps to determine the speed of the CPU in carrying out an instruction.

It is usually represented in Megahertz usually and is an important factor even though it is responsible for carrying out only basic operations and commands such as fetch, load, store, jump and others. Puja Chatterjee is a technical writer with extensive knowledge about computers. She graduated from BIMS. Her expertise includes technology writing and client relationship management gained through over 12 years of experience. Follow Her at Linkedin.