How does a Computer Work: Nowadays, we are surrounded by the computers which helps in performing our day to day work.
Every electronic device you use, for example – Mobile Phone, Microwave, Smartwatch or even simple Calculation is a Computer.
There are mainly four basic functions of a computer, which is taking Input, Storing it in Memory, Processing the data and giving the Output.
All these operations are performed with the help of 0s and 1s inside the Computer, which we have discuss below.
We as a human have invented many languages, Like – English, French, Hindi, German and many more.
These languages helps us to communicate and express our thoughts and feelings.
However, do you know what language does computer uses? The language which computer uses is Binary (0 and 1).
Each and every electronic device, you are using are working on 0 and 1.
You might be wondering that how can computer get so smart and perform complex tasks and calculations just with the help of 0 and 1.
In this article, you will get the answers of all your burning questions about the how does a computer work.
So, if you want to deep dive into Computer Architecture and want to know the actual working of computer, then this article is for you.
Four Basic Functions of a Computer
Every electronic device which can perform these 4 basic function can be called as a Computer.
- Input – Computer consist of Input Devices, like – Keyboard, Mouse, Joystick and many more, which helps in taking Input from the User.
- Data Storage – Now that Computer have taken Input from the Input Devices. The Data must be stored somewhere (RAM, HDD), so it can be easily retrieved when needed.
- Data Processing – The Data which we have stored in the Storage Unit must be sent to the Processing Unit (CPU) for performing all the Computation on Data to convert it into useful Information.
- Output – After the processing of Data, the information get displayed on Output Devices, like – Monitor, Speaker, Printer and many more.
Main Parts of a Computer
There are different Parts of a Computer for performing the basic functions. Some of the main Parts of a Computer are:
- Central Processing Unit (CPU) – CPU is like a brain of the Computer, which helps in performing Arithmetic, Logical and Input/Output Operations.
Inside a computer, there is a chip which is called as Processor. Processor is an Example of CPU.
- Random Access Memory (RAM) – RAM is the Storage Unit of the Computer, which helps in easy and fast access to the Data.
The data which Computer takes from Input Devices, firstly gets Stored in RAM. RAM is very fast as compared to other storage devices.
However, the size of RAM is not much and it is used for storing the Data temporarily.
- Hard Drive (HDD) – Hard Drive is also the Storage Unit, but it is slow as compared to RAM.
However, the storage capacity of Hard Drive is very large as compared to RAM. Hard Drive is used for permanent storage of Data.
- Motherboard – It is the circuit board which provides the platform and connect different components or parts of the computer with each other.
- Video and Audio Card – Video Card is also known Graphic Card, which helps in handling all the operations related to Graphics.
Without Video Card, you can’t play high-end games in your computer. Similarly, Audio card is responsible for handling all the operations related to Audio or Sound in a Computer.
Now, You know the basic Functions and Parts of a Computer. So, let’s deep dive into the exact working of computer with 0s and 1s.
As understanding the working of 0s and 1s will also make you understand how does a Computer Work.
How does a Computer work with 0s and 1s
The computer and all electronic devices, we use works completely on the basis of Binary Code.
When we talk about 1 and 0 in Binary, it refers to ON and OFF state or Yes and No decision, which is taken by the computer.
Everything you see in your computer is done with the help of these two digits(1 or 0) or states(ON or OFF).
Every task you perform in your computer, you get an output in human readable form. For example – Text, Image, Video and many more.
However, inside the hood, each and every task the computer performs is based on 1 and 0 or Yes and No decision.
If you get deep down on the Computer Architecture, then you will came to know that computer is just a switch, which can be either turned ON or OFF.
It is just like a bulb which can be either switched ON or OFF.
You might be wondering that how can computer do such incredible tasks with just 1 and 0 or ON and OFF.
The answer is that computer have over billions of switches inside it, which works simultaneously to perform arithmetic and logical operations.
The brain of the computer which is a Processor have over 15-19 Billion transistors.
The transistors are used to hold and release charge. It can have one of the two state (0 or 1) at a time.
So, if the transistor have charge then it is said to have 1 or ON state. And if the transistor have no charge then it is said to have 0 or OFF state.
With the combination of billions of transistor, the computer is able to perform complex calculations.
So, you might be thinking that how can computer perform Arithmetic and Logical Operations with just the help of transistors or 0 and 1 state.
The Arithmetic and Logical Operations inside the computer is possible with the help of Logic Gates.
These Logic Gates are build with the help of transistors.
Inside the Processor, Transistors are integrated or aligned in such a manner, so as to form a specific Logic Gate, which ultimately helps in performing calculations.
There are different types of Logic Gates inside the computer, like – OR Gate, AND Gate, NOR Gate, XOR Gate.
With the combination of these Logic Gates, more complex Logic Gates are built which helps in performing Addition, Subtraction, Multiplication and many more.
These Logic Gates take the input and give the appropriate output.
So, you can also say that Logic Gates are responsible for performing all the operations and calculations in the computer.
How Computer uses 0s and 1s
We as a human use Decimal Number System which is 0 to 9. Decimal Number System has base 10.
For example, if you take a number 578.
8 have base 10^0 which is 1.
7 have base 10^1 which is 10.
5 have base 10^2 which is 100.
5 = * 100 (Five Hundred)
7 = * 10 (Seventy)
8 = * 1 (Eight)
Therefor, we read it as Five Hundred Seventy Eight.
However, Computer doesn’t understand any other Number System except Binary Number System which is 0 and 1. Binary Number System has base 2.
So, a Binary Number 1101 in computer is converted in decimal as follows.
As the base of Binary Number System is 2.
1 will have base 2^0 which is 1.
0 will have base 2^1 which is 2.
1 will have base 2^2 which is 4.
1 will have base 2^3 which is 8.
So, the calculation to convert it to decimal will be as follow.
1*8 + 1*4 + 0*2 + 1*0
8 + 4 + 0 + 1
So, 1101 in Binary is equal to 13 in Decimal.
How does Computer work with Text, Image and Video
As we know that there are 26 Alphabet in English.
In computer, each Alphabet or Character is assigned a special ASCII Value.
For example – ASCII Code of ‘a’ is 097. ASCII Code of ‘A’ is 065. ASCII Code of ‘c’ is 099.
However, these ASCII Code are in Decimal Number System.
As we know that computer doesn’t understand the Decimal Number System, so these ASCII Code is converted into it’s Binary Equivalent.
a = 097 = 01100001
A = 065 = 01000001
c = 099 = 01100011
So, if you write the text “coderpedia” in your computer, then it will get save in following Binary Code.
01100011 01101111 01100100 01100101 01110010 01110000 01100101 01100100 01101001 01100001
Now let’s talk about how computer display the image.
Every photo you see in your monitor is built with the help of number of pixels, as monitor itself is divided into many pixels.
So, a pixel is the smallest unit of an image.
Each pixel has it’s own color. The value of color is in RGB(Red, Green, Blue) format, which is in human readable format.
However, Computer stores these color value in Binary format.
For example – The value of Red Color is (255, 0, 0) and the Binary equivalent of Red color is 111111110000000000000000.
So, each pixel has assigned a specific Binary Code which determines the color of the pixel.
The amount of pixels in the image determines the resolution of your image.
An image is the combination of million of pixels. So, if the resolution of the image is 2048 * 1536 (weight * height), then the number of pixels in it will be 3,145,728.
The same process is used for video as well.
The only difference is that video is the combination of number of images in a sequence.
Normally, there are 24 images or frames per second in a video, which is called as frame per second.
So, a sequence of Images are displayed to produce a Video.
High Level Language to Machine Level Language
If you are a programmer than you might be thinking that if computer only understand Binary Code, then what is the need of learning High Level Languages, like – C, C++, Java or Python.
The answer is that Binary Language is not understandable by humans. So, if someone can’t understand a language, then how can he/she write a code or program in it.
Therefore we make use of High Level Languages (C, C++, Java) for programming. However, these languages are not understandable by computer, as computer only understand Binary Code.
So, there must be a language which is understandable by humans and close to computer as well and therefore, the assembly language is introduced.
Assembly Language is a Low Level Language which is understandable by humans as well close of machine.
Assembly Language is between the High Level Language (Understandable by humans) and Machine Level Language (Understandable by computers). Therefore, it is called Low Level Language (Close to humans as well as computer).
So, when you compile a program which is written in High Level language, like – C, C++, Java, then the compiler compiles the program and returns a Assembly Code.
Then that Assembly Code (Low Level Language) gets convert into the Binary Code (Machine Level Language) with the help of Assembler.
Finally, the computer gets the Binary Code and it starts performing the execution.
Hope, you understood the how does computer exactly work.
If you have any suggestion or point which should be in this article let me know in the comment section below.