Overview Of The Central Processing Unit

Share
The CPU

The Central Processing Unit is often referred to as the CPU or simply the Processor. We call it, The Brain of the computer.

Unlike any other parts of a computer or an electronic device, The CPU does most of the heavy lifting. The entire processing tasks of a device are all handled solely by the CPU in collaboration with other parts of the device.

What does it do ?

Going back to the definition of a computer program,

A computer program is a list of instructions that we write using a programming language which the computer understands.

So basically, Whenever we run a computer program (Skype, Google chrome or any application you can think of), we are actually loading instructions into our systems memory. The CPU then fetches the program instruction from memory, decodes the instruction and executes it.

This fetch – decode – execute cycle is referred to as the fetch-execute cycle.

The interesting thing is, The CPU actually does not understand the instructions written using the programming language that we were talking about just a minute ago in the above definition.

How does it do all those stuffs ?

We humans communicate with each other using our own cultural or native language (English, Chinese, Hindi etc). Likewise, The CPU understands and communicates using a special kind of language – The Machine Language.

It is the only language that the CPU understands and the whole language is just a combination of two digits – 0 and 1 or on and off.

If you ever take out the CPU chip from your computer and observe it through a high-tech microscope, you will notice that the circuits in the CPU are made up of some millions or billions of small switches.

These switches are often referred to as transistors. A transistor gets activated or deactivated by the electronic signals it receives.

Today`s modern processors (i3/i5/i7) have over 1.5 Billion transistors.

We all are familiar with switches. They are used everywhere throughout the world to turn on/off the light bulbs and home appliances.

If the switch is ON, It means that the bulb will glow. And if the switch is OFF, that bulb wont glow. The CPU follows the same convention as that of the switch to represent data and transmit information.

Switch

Unlike the light bulb switch, the CPU makes use of multiple combinations of  transistors/switches to communicate and process data. The number of combinations used can vary depending on the amount of data it needs to handle at a time.

However, In the technical world, The On and Off are represented in binary format as 0 and 1. Each 0 and 1 is known as a bit. It represents the smallest unit of data in computing.

 0 and 1 is just a way to represent that a transistor is either On or Off

If the data size is larger, the CPU will make use of multiple combinations of bits to hold that data.

Lets say, You wanted to display one single character ‘A‘ in your computer.
In terms of binary, it would mean 01000001.

Here, the letter A is represented by a combination of 8 bits. This 8 bits combination is called a Byte. In most of the computers, 8 combinations of bits – a byte is used to represent a single character or a symbol.

Just like the letter ‘A‘ , Documents, Images, Audio, Characters and any kind of data are all just binary numbers in the eyes of the CPU.

 

Machine language is simply the composition of these binary digits.

If I wanted to tell a computer that I like bananas, I would have to say something like this :

01001001 00100000 01101100 01101001 01101011 01100101 00100000 01100010 01100001 01101110 01100001 01101110 01100001 01110011

This composition of 0 and 1 is called the machine code. And it is the only code or language that the CPU understands.

What are these strange 0 and 1 combinations ?

Just a minute ago, We saw that the letter ‘A’ in binary meant 01000001.

This strange way of representing data is called data encoding. It is a very important concept in the field of Data Science. As a programmer, You will stumble upon lots of other encoding formats in the future. This one particularly is called binary encoding.

However, there are different standardized binary encoding formats.

  • Text is encoded in character sets. eg: ASCII, Unicode
  • Images are encoded as file formats. eg: JPEG, PNG, BMP
  • Videos are encoded as video file formats. eg: MPEG4, FLV
  • Audios are encoded as audio file formats. eg: mp3, wav

There are other more user friendly ways to represent binary digits. The most common one is the hexadecimal format (base 16 or  hex).

In hexadecimal, The letter ‘A’  would be represented as 41.

But, learning all the numbering formats wont make us a programmer.

What Next ?

It is possible to write a computer program using only machine code. But the task is very time consuming, error prone and tedious.

Machine code also differs slightly across every version of the CPU Chip and across different hardware. It is hence troublesome to keep track and write code for every version of the CPU chip.

Instead, we could just write our programs in one format and later on convert it to the desired machine code.

Lets look at how it is done ….

You may also like...

Leave a Reply

Your email address will not be published.