Part One: Hardware world
Chapter 1: Data representation on computer hardware
Table of content
By data representation inside the computer, we mean that how to speak with the computer with its language … Explain more?
In the course introduction, we said that the goal of computer science is to study algorithms, and we said that an algorithm is just a finite number of steps you should follow to solve a certain problem.
Imagine with me, what if you have a problem and you want to ask your friend to help. Suppose your friend speaks a different language, say Arabic. How to tell your friend about the problem you have and its algorithm in Arabic. First, you need to think about what you want to say in English then convert that to Arabic. What you did is you represent your English words to Arabic.
The same is in the computer. To make the computer execute a certain algorithm, you need to represent that algorithm in the computer language.
Here we need to ask 2 questions:
First question: what is the language of the computer? You will say 0s and 1s of course. That is right. We call it a binary language because it consists only of 2 symbols; 0 and 1. Therefore, data representation inside the computer means how to convert the data by our language to binary language, or 0s and 1s.
Second question: We use our language when dealing with computers every day and we don’t use the binary language and the computer understands us. Is that mean that the computer converts the data inserted in our language into 0s and 1s automatically? Exactly. But how?
If you speak to an Arab friend and you don’t know how to speak in Arabic and your friend doesn’t know how to speak English, then you need someone to translate. This translator knows how to convert Arabic into English and Vice versa.
This is the same case with the computer. There is a translator that translates your language into binary language and vice versa. This translator is called a compiler. We will create a different course for compilers.
So, for this compiler to be able to translate your language to the binary language, it needs to know how to convert numbers, alphabets, special symbols, images, videos, and audios into zeros and ones. This is what we will see in this chapter.
Now, we know that we must speak with the computer in zeros and ones, but the question is: how does the computer speak while it is inanimate? How do find zeros and ones on an inanimate object?
Let’s conclude that.
What is the only thing that makes the computer work? Of course, electricity.
Is that mean that the data we see every day on your computer screen is just electricity? And the zeros and ones originally come from electricity?
Exactly. But how?
What is the only way by which you can use electricity? Of course, to use electricity, you will switch it on and if you want to not use it, you will switch it off.
What if we denote 1 for on, and 0 for off?
Ok, that is fine, but if I switched the electricity off, the computer goes off.
Let me explain more.
We all know that there is a processing unit inside a computer called a CPU (central processing unit). This processing unit consists of billions of electric circuits. Each circuit can be switched on or off by a component called a transistor. The sequence of on and off are the zeros and ones. The following image can show that.
What?! Is that mean there are no actual 0s and 1s move inside the computer?….. In fact no. They are just pulses of electricity with a certain voltage value resulting from the electric circuits that are switched on or off in a certain sequence to represent data. This is the way by which the computer speaks.
And in this chapter, we will talk about it also.
But there is a question. If the data is just electricity, this means when we switch the computer off, the data will be lost but this is not what happens because we found the data is stored on the hard desk even if we switched the computer.
Ok, that is right, but we have 2 different ways to represent data, one of them is using electricity, and when you switch the computer off, only the data on the RAM (Random access memory) is lost but storing data on a hard desk uses a different method which we will talk about in the course also.
So, from the next video, we will see how to represent numbers in zeros and ones.
Watch Our video: