What is a Processor?
A processor is a component in a computer which performs operations on a set of instructions it receives from various other computing elements and produces an output. In simple words, it receives an input, processes it, and provides an output.
What is the purpose of a processor in a computer?
A computer is only capable of reading and executing in machine language and for that reason, every instruction and data in a computer are represented in a binary form i.e. 0’s and 1’s. Your photos, videos, music, documents, text files etc, consists of nothing but a combination of zillion number of 0’s and 1’s, and to interpret and execute this data we require a processor.
Let’s take a simple addition expression 3 + 8. In machine code, it is represented as 00000011 + 00001000 and a processor performs operations on these 0’s and 1’s. But as the complexity of a program increase, a processor has to perform a lot of numerical operations. A CPUs performance can be evaluated by its clock speed, the number of cores and the technology it uses, so let’s understand what it is and how it functions.
What is a clock speed?
A clock speed is the total number of clock cycles a processor can perform in a second. For example, a processor with 1.6 GHz Clock Speed can perform 1.6 Billion clock cycles per second. A higher clock speed increases the CPUs capability to execute more instructions per second.
But over the years the clock speed hasn’t really changed much. Manufacturers are releasing a new processor almost every year but the clock speed seems to be almost the same, then how is the newer generation CPUs any good than its predecessor? What is the difference between two same processors of different generation running at same clock speed and how do you determine who’s faster than the other? The answer to that is Instructions Per Cycle (IPC)
IPC is the number of instructions a CPU can execute per clock cycle. Basically, the way a processor works is that it fetches instructions from the memory, decodes it, executes the instruction by performing necessary operations, access the memory and stores the result back in the memory. These stages i.e. fetch, decode, execute, memory access and write back, each takes one clock cycle to execute a single instruction. So a total of 5 clock cycles to execute one instruction. However, the number of instruction executed per clock cycle is not a constant value, it changes based on the software’s requirement. Sometimes it may take more than one clock cycle to execute one stage.
In order to improve the frequency of IPC, pipelining is used. Pipelining is a way to improve the efficiency of a processor by increasing instruction throughput per clock cycle. It executes multiple instructions in parallel to achieve more IPC. Think of pipelining as a car assembly line, there are various stages in building a car. When work at stage 1 is completed and the car moves ahead to stage 2, the workers in stage 1 starts working on the next car.
IF = Instruction Fetch,
ID = Instruction Decode,
EX = Execute,
MEM = Memory access,
WB = Register write back
Due to pipelining, instructions will be completed every clock cycle. However, the time needed to complete the stages of instruction is not reduced.
Number of Cores in a Processor
The number of Cores in a processor is the number of processing units that can work simultaneously. In simple terms, a core count denotes the multitasking ability of a CPU. More the number of cores in a CPU, better it is at multitasking. Having more Cores allows the CPU to split the workload across the processing units to achieve better performance. If you have a Dual Core CPU, it will divide its workload across these two cores, which will work concurrently. Think of it as the number of laborers working on the construction of a building, more the number of laborers faster will be the construction process.
Core Count vs Clock Speed
In general, both the number of Cores and the Clock speed helps with the CPUs performance. Then what’s the difference between a Quad Core at 2.7 GHz and a Dual Core at 3.1 GHz? Should you give more priority to the number of cores or the clock speed? Well, the answer to that really depends on what you’re planning to use your computer for. If you plan on using multithreading applications, such as a video editing software which requires a lot of multitasking, you should consider a CPU with more number of cores. If you want a computer for gaming purposes, you should consider a CPU with higher clock speed.
What is Hyper-Threading?
Hyper-Threading is a technology which improves the resource utilization of a processor and helps to increase the processor throughput. If you have a Dual Core processor with HT, it will appear as Quad Core processor to the Operating System. However, a Dual Core processor with Hyper-Threading is not the same as a physical Quad Core processor. Hyper-Threading doesn’t necessarily make your CPU faster, it’s just a way of scheduling the threads so that the cores of your processor doesn’t remain idle for a long time. A processor with HT is useful for multi-threading applications but for single-threaded workload having a processor with HT is of no use, because the CPU needs to perform the tasks in a sequential manner.
Turbo Boost vs Overclocking
Turbo Boost is a temporary clock speed that a processor can push itself to under maximum load. A Turbo Boost will boost a processor’s clock speed up by 0.4 or 0.5 GHz over its base clock. But this will result in higher temperature and voltage consumption and if the CPU cannot handle the additional temperature it will return back to its base clock.
You can relate Turbo Boost to NOS in the context of car racing. In a car racing event, the NOS can temporarily provide that extra power to the engine when needed but the temperature of the engine will increase while pushing the engine beyond its limits. If we continue to push the engine at extreme temperatures, the car will eventually break down.
Overclocking is pushing the processor’s clock speed to the Turbo Boost level full time rather than as needed. But as we said above, it will lead to rising temperature and can damage your processor. It is not recommended to overclock your processor unless you have a very good cooling system.