...

The MHz Myth

by John Paul Chacha on Sat, 2nd Dec 2017. Read 5857 times.

Between a phone with a dual-core processor clocked at 2 GHz and a desktop computer with a dual-core processor clocked at 1 GHz, which is faster?

 

If you answered “the phone”, you’re wrong – the computer is actually several times faster than the phone. It’s called the Megahertz Myth – the incorrect belief that different platforms can be compared based on the clock-rate alone (MHz/GHz). Let me explain.

 

CPUs are made up of millions of little circuits that need to work together to achieve any given task. To co-ordinate these activities, the CPU is fed with a timing signal consisting of series of electrical pulses. Whenever a pulse is received, something happens. This signal is called the CPU clock, or simply the clock. The rate at which the clock operates is called the clock-rate, and is measured in hertz (Hz). 1 MHz means that 1 million clock pulses are sent each second, and 1 GHz means 1 billion. The duration of each clock pulse is called a clock cycle.

 

Software is delivered to the CPU as a list of simple mathematical operations called instructions. Each instruction is a simple operation such as “add X and Y”“divide X by Y” or “jump to instruction number 10 if X is less than Y”. More complex operations are broken down into a series of such simple operations.

 

Because of the inherent complexity of doing math using circuits, the processor usually subdivides each instruction into smaller internal units which are executed by different circuits, for which reason the CPU may need several clock cycles to execute one instruction. This is known as instruction throughput. If a CPU needs 5 clock cycles to multiply two integers, we say that its instruction throughput for integer multiplications is 1/5. Multiplying the clock-rate and the instruction throughput gives you the MIPS (Millions of Instruction Per Second) or FLOPS (Floating-Point Operations Per Second).

 

The set of instructions accepted by a CPU is known as its instruction set, and it determines how many instructions you need to achieve a particular task. For example, some CPUs can load and add data in one instruction, while others implement the loading and the adding as two separate instructions. Some instructions may be present in some and missing in others, forcing the programmer to write a mini-program to implement the missing functionality. Since the instruction set determines how software is written, it is an fundamental property of any computing system which must be known before software is written, which is why you can’t just copy-paste software across different platforms.

 

Now, back to the original question: why is the computer much faster? It is faster because although it has a lower clock rate, it has a much higher instruction throughput and is based on an architecture that can do much more work within each instruction. CPUs for desktop computers and laptops are generally based on what is called CISC (Complex Instruction Set Computing), where each instruction is designed to do a lot of work at one go. They are also designed to further increase instruction throughput by utilizing techniques such as superscalar pipelining, which allows new instructions to start processing while the old ones are still being executed. All these features make them fast, but they also make them complicated, expensive and very power-hungry, which is why they need elaborate cooling systems. On the other hand, CPUs designed for phones use the opposite philosophy – RISC (Reduced Instruction Set Computing). RISC processors adopt simple instructions, which allows them to have simple internal circuitry, hence reducing size, cost and power consumption, which is why your phone does not need a cooling fan and can fit in your pocket. The price they pay for that simplicity is significantly reduced performance. The kind of software used on phones doesn’t require the kind of horsepower that PC software requires, so this is generally not seen as a problem.