r/computerscience • • Feb 12 '26
How is computer GHz speed measured?
How do they get the value for cpu Ghz speed. And why is it measured in Hz?
29
Upvotes
r/computerscience • • Feb 12 '26
How do they get the value for cpu Ghz speed. And why is it measured in Hz?
85
u/khedoros Feb 12 '26
A computer's chips are synchronized by a "clock". Basically every time it "ticks", the chips move to the next step of whatever they're doing. It's measured in hertz because it's a count of the number of clock ticks per second.
19
u/wtallis Feb 12 '26
Processor clock speed is typically not a quantity that is or needs to be measured. It's the independent variable; clock signals are generated in the computer to drive and synchronize the various components, making the clock speed an input parameter that is used to control the processor's behavior. The observable properties of the system that you would typically be measuring as dependent variables would be things like performance and power consumption, which will vary with changing clock speed.
Determining the maximum clock speed a particular chip can run at is typically done experimentally: set it to a clock speed and see if it works without error. If it does, try a higher speed. (Voltage is also a factor here; higher voltage can allow for running at higher frequencies, but too much will kill the chip.)
16
u/kag0 λ Feb 13 '26
The CPU is a giant circuit. The various parts of the circuit can have a current, or not (on or off, 0 or 1). One of the inputs to the circuit is the "clock" which causes the other parts of the circuit to update. The speed is the number of times the clock can flip on and off every second (Hz is a measure of how many times something happens per second).
3
u/Rich-Engineer2670 Feb 12 '26
I'm no expert here, but as I recall, the chips run on a "drum beat" of a base clock frequency --that's where it comes from --it used to be a real crystal, but I would imagine we're upgraded the timing since then.
2
u/Character_Cap5095 Feb 13 '26
In GHz obviously
1
u/MasterGeekMX Bachelors in CS Feb 13 '26
We don't get that value. We set that value.
See, CPUs are complicated enough that simply feeding it the signals for the data and instructions you want aren't enough. We also need to feed it with a signal that turns on and off at a regular pace, so the CPU can use it to coordinate things inside it, such as advancing to the next step in running the program, for example. That is the reason why that signal is named the Clock of the CPU.
The unit of measurement of it is the hertz, because it is the unit of measurement for things that happen at a regular pace. Named after the German scientist Heinrich Hertz, one Hertz is one thing happening once a second, two Hertz is that thing happening twice a second, and so on. Hertz are used for how many hills of a wave pass by (be it radio waves or the waves on a pond), how many times air vibrates on a sound, how fast something flickers, etc. There is no other measure unit for that kind of things.
See it like this: the CPU is like an orchestra. The CPU clock is like the director of that orchestra, swinging his stick to give the musicians the clue of when to play. The director does not get the pace at which it conducts; the director knows at which pace it conducts.
1
u/whattteva Feb 13 '26
Digital systems are systems that operate with signals that need to be synchronized for reliable and stable operation. This "reference signal" is called the "clock". It rises and lowers at a certain rate per second (Hz) forming a pulse signal or sometimes also called square waveform. Other signals usually use this rising (or falling) edge to synchronize their signals. Some can also synchronize on both rising and falling edge (DDR). The G just means 1 billion times. So 1 GHz just simply means billion times per second.
Typically, there is an oscillator crystal that generates this reference signal. Most commonly a Quartz. The number of times the atom oscillates is very precise and reliable for an accurate reference.
1
u/TomDuhamel Feb 13 '26
That's not a measurement of speed, that's a frequency. A higher frequency (higher clock speed) means the CPU could (technically) run more instructions per second, which is where the CPU speed comes from.
1
u/anothercorgi Feb 13 '26
GHz is a measurement of how fast the logic is changing inside the chip. This is the clock that flips at 1 to 0 and back to 1 at that frequency, which is in Hertz. Of course to measure something you need a reference. Normally for a CPU to measure its own clock frequency it use the TSC which ticks up every time the clocks flips. An external clock separate from the CPU of known value (like the 8254 PIT that is common to all PCs, HPET, or something similar; the battery powered Real Time Clock can also be used) is used to read the TSC and a little math will get you the clock frequency that can be printed on the screen.
Of course this value can change over time with turboboost and power saving features so it's definitely not constant.
1
u/LateSolution0 Feb 13 '26
Logic-Gates are build from transistors. each Gate takes sometime to change so chaining a bunch of logic gates to build circuits means you have to wait for some time to get the correct result like if you would measured its fluctuate for a while til you get into a stable state. if you combine logic Gates to add 2 numbers you get the correct result after some time not immediately. Some clever folks design clock-less circuits so the circuit itself can signal when its ready to use its signal.
CPUs don't clock themself they are forced to run at certain clock. historically they derived the clock from the front-side-bus. so the rule was FSB * MULTIPLIER = CLOCK. Modern cpu don't have a north bridge anymore but the concept translates to Base Clock BCLK.
Hertz is just how many cycles per second. nothing fancy you can calculate how long a cycles takes by T = 1 / f.
so 1GHz(1'000'000'000) just means each cycles takes 1ns.
1
u/vancha113 Feb 13 '26
Did you know that if you run electricity through a crystal, it vibrates? The size of the Crystal influences the exact frequency with which it vibrates. These are used inside computer processor to drive the digital logic, here's a cool video by Steve mould that explains the process: https://youtu.be/_2By2ane2I4?si=ugiFS0yyVoQO0Ep3
1
u/ObjectBrilliant7592 Feb 13 '26
The computer's "clock" comes from a clock generator (usually on the motherboard). The CPU itself handles the clock signal to do logic and can function effectively up until a certain frequency, but you can still overclock it past its recommended rate.
Hz are the SI unit for frequency.
1
u/xz-5 Feb 13 '26
It's basically a measure of the "clock speed", it's in Hz because Hz measures frequency (number of times something happens per second), and the computer's "clock" is ticking very fast. The second hand on your wall clock ticks at 1 Hz, because it advances once per second. If it moved at 10 Hz, it would advance 10 times per second. GHz is 10^9 (a billion) times per second. You need specialist electrical measurement equipment (an oscilloscope or similar) to measured that speed, as it is much too fast for humans to see in any way.
The "clock" in the computer is used to synchronise everything that is happening (the CPU, RAM, peripherals, etc), and it has a specific value that is set on purpose to make sure the hardware is reliable (too fast and some parts might not work properly). When they manufacture the CPU, they will test what frequency it can work reliably at, some will work better than others, and then it will usually get used at the maximum safe frequency. Users can often override the speed if they like, this is called "overclocking", and can get quite good performance results if you are careful.
1
u/fixermark Feb 13 '26
All of this basically captures it. The only other thing possibly worth mentioning is why the clock is there.
Electrical field change isn't instantaneous, although it does move at a pretty good percentage of lightspeed. But when inputs on a logic gate change, the voltage on the gate outputs actually "ramps" from one value to another over a small period of time. What effect that ramping has on the next gate is hard to predict because it depends on the exact molecular structure of every single gate (in practice, gates are built to tolerance where they say "I output a 1 voltage if I get these inputs and a 0 voltage if I get these inputs, and if you give me inputs between 0 and 1... I dunno, something will happen!").
The clock creates a "moment" where the system can believe that all the gate outputs have stabilized and are ready to be used. Generally, it closes circuits that expose inputs downstream to the outputs from upstream and let them change in response to those inputs. If you tweak the clock too high, you catch the logic gates between states and risk pushing a wrong answer downstream (like "1 and 0 = 1", because the AND gate happened to actually see like 0.65 and 0.35 and its tolerances weren't tight enough to treat the 0.65 as a 1 and the 0.35 as a 0).
1
u/peter303_ Feb 13 '26
Lightspeed travels one inch in a twelve billionth of a second. Slower than that in metal. So synchronization across the width of a chip becomes a factor at approaching 10 gigahertz.
1
u/Plastic_Fig9225 Feb 13 '26
GHz to a CPU is like the liters of displacement to a car engine. There is a rough correlation between GHz and computing speed, just as there is between displacement and power of an engine.
1
u/FrequentTown3 Feb 15 '26
1 / (the time it takes for a cpu to finishes a clock tick) = freq
1
u/Bulky-Leadership-596 Feb 15 '26
What are you going to measure it in beside Hz? The SI unit for time is the second and Hz is just 1/s. Do you want to measure it in cycles per millennium or something? We can call that an Alchy. Then a Pentium III runs at 44 exaAlchys.
0
u/[deleted] Feb 14 '26
You're the same guy that said that he's a genius but can't get degree because of ADHD?
-7
u/SgtSausage Feb 12 '26
Wow
-4
u/Snag710 Feb 13 '26
A hurt is 1,000 pulses a second. Kilohurt is 1000x that. Meghurt is 1000x a kilohurt. Gigahurt is 1000x a megahurt.
This measurement system is used for many things like in radio/wifi frequencies where the rate that your signal broadcasts at is used to tune into a specific broad cast, and high frequency radio waves are usually reserved for local high speed data connections.
In a computer we usually use gigahurtz to measure how many commands can be executed per second
So a 3GHz cpu would be able to execute 3,000,000,000 commands on a single core every second and can do something like double that if it's multithreaded.
Most modern CPUs have multiple multithreaded cores which multiplies the processing power but we still measure it by one core when labeling the CPU with its projected speed