A bit
All digital computer data (texts, photos, music, applications, ... ) is stored in computer memory (RAM, Hard Disk, CD, DVD, BlueRay disc, USB stick, ...) as "bits". But what are bits? Zeros and Ones? Not really. If you look through a microscope at the surface of a Hard Disk, you will not find very small numbers written on it.
A bit is a "yes" or a "no": yes or no electrons (RAM memory), yes or no light reflecting (Optical disc), yes or no positive magnetic force (Hard disk). But when talking about bits, a "no" bit we call a "0", and a "yes" bit we call a "1".
A bit confusing
A group of 8 bits is called a byte. With a "Kilo Byte" people sometimes refere to 1024 bytes and sometimes to 1000 bytes. KB = Kilo Byte, and Kb = Kilo bit (eight times less than a KB), I personally would like to drop all that because it's confusing.
I would rather talk about bits only, and use 1000 for a Kilo.
How not to read bits
It's not like 0 is nothing and 1 is one, not like this:
0 = 0
1 = 1
11 = 2
111 = 3
1111 = 4
That would be very inefficient.
Imagine having to write down the number 16777216
The power of combining bits
This is the most efficient digital way of storing values:
0 = 0
1 = 1
00 = 2
01 = 3
10 = 4
11 = 5
000 = 6
001 = 7
010 = 8
and so on.
Problem with this variable bits length is that it's also necessary to note how long each code is, which makes it less efficient in some situations. Less complex is to use fixed bits length. For example for a gif image with only 8 colors:
000 = color 1
001 = color 2
010 = color 3
011 = color 4
100 = color 5
101 = color 6
110 = color 7
111 = color 8
How to read bits (fixed length)
Here an example of a fixed length of 8 bits.
The first bit is at the right.
When the first bit is a 0, it's value is 0. When it's a 1, it's value is 1.
When the second bit is a 0, it's value is 0. When it's a 1, it's value is 2.
When the third bit is a 0, it's value is 0. When it's a 1, it's value is 4.
And so on:
bit #4 can be 0 or 8
bit #5 can be 0 or 16
bit #6 can be 0 or 32
bit #7 can be 0 or 64
bit #8 can be 0 or 128
And to get the total value of these eight bits, simply ad them up:
00000000 = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0
11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
01001011 = 0 + 64 + 0 + 0 + 8 + 0 + 2 + 1 = 75
10110100 = 128 + 0 + 32 + 16 + 0 + 4 + 0 + 0 = 180
|