How does a computer store data?

Tram Ho

When you enter something like “abc” and then click save, after a few days, click again to see that the computer still shows the correct “abc” on the screen.

So the computer saves “abc” directly to the hardware, right?

No, the computer converts everything to “0” and “1” and then saves.

Binary

Indeed, now that I “split” the computer in half, I only see “0” and “1” 🐵 That’s a lucky case, but unfortunately, when I split it, I can’t see anything anymore 🐭🐭

The number “0” represents “off, the number 1 represents “on.” Computers contain millions and billions of light bulbs that are off and on to recognize and remember data.

Because it is 2 numbers, it is called “binary”, the more beautiful name is called “binary”, the full name is “Binary”.

Number

So the computer only holds 2 light bulbs, “0” and “1”, how can it recognize and store the sequence of numbers 0->9 (10 digits should be called Decimal), then tens of thousands hundred thousand, ten million hundred million?

It’s not difficult, when it’s lacking, just add it. If there is only 1 light bulb, only 0 or 1 can be stored, but if we have more bulbs, we can “name” more numbers.

a.If there is only 1 bulb

Number 0: 0

Number 11

b.If there are 2 bulbs

Number : 00

101

Number 2: 10

Number 3: 11

c.If there are 3 bulbs

Number 0: 000

Number 1: 001

Number 2: 010

Number 3: 011

Number 4: 100

Number 5: 101

Number 6: 110

Number 7: 111

Miraculously, with only 3 light bulbs that can name 7 numbers, no one has the same name as another.

Each bulb is called 1 bit, then we need 3 bits to store and represent the numbers 0 to 7.

Returning to computers, computers usually use 8 bits to store and represent a number.

For example, the number 7 would be stored in the form of 8 bulbs (8 bits) as 00000111.

You can try to write the next numbers on paper according to the rule “0-1-10-11-add 1 and reset to 0” and then look up the “binary x number” syntax to check if you wrote it. isnt it right? Following example:

Number 7: 111 (The light bulb has been used up)

Number 8: 1000 (Add 1 and reset to 0)

Number 9: 1001 (It’s 1 here)

Number 10:1010 (It’s 10 here)

Letter

Numbers know the computer uses “0” with “1”, so what about letters? The answer is, “also 0 plus 1”.

But to avoid the duplication of letters and numbers, an extra set of ASCII codes was created to divide the boundaries. Are the characters in this ASCII table familiar? Yes, it’s your keyboard. Letters will be converted to decimal based on this ASCII code, and then from that decimal number to binary. Character type → Number type (Decimal) → Bit type (Binary) Example: The letter A is represented by the number 65 → The computer’s hard drive will store the letter A as 1000001 (Binary code for the number 65) ) For each character in the ASCII code set, the computer level 1 contains 8 bits to represent the character. That 1 compartment is called 1 byte.

• 1kilobyte (KB) = 1024 bytes
• 1megabyte (MB) = 1024 KB
• 1gigabyte (GB) = 1024 MB= 1 073 741 824 bytes

That means 1 GB is more than 1 billion character compartments.

The phone you hold in your hand is 32 GB or 64 GB or 128 GB, so you can estimate how many compartments and how much data can be stored.

Emoticon

Also known as Emoji, what does it represent?

People again generate a code named Unicode to name each symbol.

Unlike the ASCII code set which is designed to represent only basic English characters, the Unicode codec is designed to support characters from all languages ​​of the world.

The standard ASCII character set only supports 128 characters, while Unicode can support around 1,000,000 characters.

While ASCII uses only 1 byte to represent each character, Unicode supports up to 4 bytes per character.

![image.png] Unicode encoding has 172 fonts, some commonly used fonts such as Times New Roman, Tahoma, Arial, etc.

Example 1: Code point U+0041 is the hexadecimal number 0041 (equivalent to decimal 65). It represents the character “A” in the Unicode standard.

Example 2: The character string “Hello” in Unicode, this character string corresponds to 5 code points (note 5 code points, not 5 bytes): U+0048 U+0065 U+006C U+006C U +006F “U+” stands for “Unicode”, and the coefficient part is hexadecimal.

Example 3:

• Icons
• Name: SMILING FACE WITH OPEN MOUTH
• Code in Unicode: U+1F603
• UTF-8 code: F0 9F 98 83

You can refer to [ https://unicode.org/emoji/charts/full-emoji-list.html ] for more details.

Color

Have you ever heard of the concept of RGB? It stands for Red-Green-Blue (Red, Green and Blue) which is a combination of three numbers.

Strings 72, 73 and 33 represented in the ASCII table will output the word “HI!”, which in the RGB codec is interpreted as light yellow.

The red value will be 72, the green value will be 73, and the blue value will be 33.

Pictures, video and audio

An image is simply a collection of RGB values.

A video is a sequence of many images stored together, like a flip book.

Black Vau wrote the paragraph “The computer that I recorded the first few songs on, my mother changed it with many days of sweat” is exactly like the sentence, recorded from the computer, not any other recorder. Music alone is represented through MIDI data.

Details can be viewed here. https://www.thegioididong.com/hoi-dap/file-midi-la-gi-ban-chat-co-che-hoat-dong-cua-midi-trong-1365434

So we can imagine how basic data is written to the computer.

Where in the article is still unclear, please comment below.

Share the news now

Source : Viblo