Digital technologies are everywhere in our daily life today, they are used by our computers, but also by our mobile phones, our televisions or our vehicles for example. These technologies use data (photos, videos, messages or music for example) in the form of bits.
What is a bit then?
It is the representation of the state of a very simple system which can only have two distinct states, which is called a binary system. A lamp may be switched on or off for example, a transistor may or may not let an electric current pass, a sound may or may not have a certain frequency, a group of atoms may or may not have a magnetic property, an affirmation may be true or false.These two states can be associated with two different numbers, the number “0“ for the “off” state and the number “1″ for the “on” state for example.
If several systems are available and each one has a binary state, the state of each of them can be represented in the form of a “0” or a “1”. The state of the three switches of the image below can therefore be represented as “1”, “0” and “0” for “on”, “off” and “off”.
How to represent more complex information with a set of bits?
If a single bit can only represent the values “0” and “1”, a set of bits can be used to represent much larger values. One of the ways to do this is to use not only the values of the bits but also their positions in the set. The position of each bit is associated with what is called a power of 2. The 3th power of 2 for instance is denoted 23; it corresponds to multiplying the number 2 three times by itself, so 23 is equal to 2×2×2 = 8. You can find out more information about the powers of two on this page.
By convention, positions are counted from right to left in a set of bits. The rightmost position is position 1 and the corresponding bit will have its value multiplied by 20 ie 1 (by convention 20 = 1). The next bit has position 2 and its value will be multiplied by 21 ie 2, and so on for each of the following bits to the left. The table below shows the powers of two used for a set of 8 bits:
|Power of 2||27||26||25||24||23||22||21||20|
To calculate the value represented by a set of bits we simply add the value of each bit multiplied by the corresponding power of two.
Let’s see how it works with an example: for instance with “10101011”:
|bit × multiplier||128||0||32||0||8||0||2||1|
With the bits of this example the result is 1×128 + 0×64 + 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 1×1. which gives 171. This set of eight bits therefore represents the number 171.
What is a byte?
A byte corresponds to a set of eight bits such as the one in the previous example. These eight bits are used to represent numbers between 0 (if all the bits are set at 0) and 255 (if all the bits are set at 1). The table below makes it possible to verify that the set of bits “11111111” does indeed correspond to the number 255.
|bit × multiplier||128||64||32||16||8||4||2||1|
As a side note, the first consumer microprocessors of the 1980s were said to be “8-bit” because they worked internally with 8-bit registers. This was the case for example with Intel 8080, MOS 6502 or Zilog Z80 processors that allowed a generation of geek to discover computer science.
Be careful not to confuse bits and bytes!
There is therefore a relation between bits and bytes (a byte uses 8 bits) and a common error consists in using them indifferently in the daily language. But be careful as they correspond to two different things. A set of 1024 bits is not the same thing as a set of 1024 bytes for instance. The number of bits has to be divided by eight to get the number of bytes, 1024 bits therefore correspond to 128 bytes (1024/8 = 128).
Bits and their multiples are often associated with the baud rate or the speed of communication of a network. The bandwidth, that is the amount of data that can be transmitted per second, is often measured in Mbits/s (million bits per second) or Gbits/s (billion bits per second).
The capacities of memory modules and hard disks in the other hand are expressed in multiples of bytes, 8GB (8 gigabytes), 256 GB (256 gigabytes), 4 TB (4 terabytes) for example.The post What are bits and bytes? appeared first on EatYourBytes