Bit in Computer Science

The word “bit” comes from “binary digit”

Introduction – Numerical Systems

Before going into the main topic which is bit in computer science, let’s start from a mathematical approach.

A digit is a quantity of one figure that has a value and occupies a position in some numerical system. Let’s take as an example the decimal system that we use on a daily basis. This system is composed of 10 symbols that we call numbers (0,1,2,3,4,5,6,7,8,9). Each of these symbols has a value assigned to it and given two different numbers we can order them for example from least to greatest.

It is also said that the decimal system is a “positional system“, that is to say that a digit acquires value according to the position in which it is located. This is something we are taught at a very early age, the subject of “units“, “tens” and “hundreds“. The values 1, 10 and 100 are composed of the same digit 1, but they are not worth the same because that digit is in different positions. In other words the position in which a digit is found will have an associated weight, a 1 in third position is worth ten times more than a 1 in second position and one hundred times more than a 1 in first position.

Once a positional number system such as decimal has been established, we can begin to construct operations between numbers such as addition, subtraction, multiplication and division.

Are there numerical systems other than decimal?

The use of the decimal system is centuries old and it is thought that its origin lies in the fact that human beings are born with ten fingers. It is the numerical system that is mostly used worldwide, however nothing prevents us from using any number of symbols to establish a positional numerical system, for example if instead of using 10 symbols we use 8 we have the octal numeral system, on which the same mathematical operations of the decimal system are also defined.

Let’s think about the following example, in the decimal system the operation 9+1 gives as a result 10, where the 1 that is in the second position we know that it has a value or weight of ten. If we take this same example to the octal system, in which we have the numbers (0,1,2,3,4,5,6,7), the operation 7+1 gives as a result 10, where the 1 in the second position has a value or weight of eight.

Another known system is the hexadecimal system that has 16 symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F), in this case the operation F+1 results in 10, where the 1 in the second position has a value of 16.

Another number system can be the binary system which is the one that interests us in this article, the binary system is composed of two symbols, zero and one, in this system the operation 1+1 results in 10, in which the 1 that is in second position has a value of 2. On the binary system can also be performed the operations of addition, subtraction, multiplication and division, but it has also been developed Boolean algebra that defines logical operations between binary numbers as the operations CONJUNCTION (AND) and DISJUNCTION (OR). And finally we come to the objective of this article, reiterating the opening sentence:

A “BIT” is a digit of the binary system.

What is a Bit in Computer Science?

In computing, the “bit” is the basic unit of information, which allows us to distinguish between two states.

Bits are grouped together to form binary words. A binary word of 8 bits is known as a Byte and allows us to represent 256 different states.

The processors in conjunction with RAM and ROM perform operations using binary words.

One way to understand how processors work is to study the different computer architectures. For more information, see the Von Neumann architecture.

So by using bytes (which are made up of bits) it is possible to represent increasingly complex information, not only numerical, but also text, sounds, images, and to perform logical and mathematical operations on that information.

For example, using 3 bytes we can represent any color in the RGB system, one byte for the red channel, one for the green channel and one for the blue channel.

Another example could be that using a byte we can represent a character, then a sentence will occupy a space in memory proportional to the number of characters that compose it.

What is the difference between BIT and BYTE?

Bit and Byte are two terms that are often confused or even used as synonyms, so let’s emphasize this. As we saw earlier, a BIT is a binary digit that can have a value of zero or one, while a BYTE is an ordered arrangement of EIGHT BITS. A bit allows us to represent two different states while a BYTE, being a combination of EIGHT BITS allows us to represent 256 different states, 2 raised to the 8 possible combinations.

The size of Information

I invite you to do a little experiment to see how much space information takes up in computers. The experiment consists of opening Notepad and pasting the following sentence without the quotation marks:

“The letters that make up this phrase occupy a certain amount of memory space.”

The previous phrase has 77 characters, take a look of the size of the .txt file.

an image to visualize the size of information in computer memory
Fig. 1: A txt file with 77 characters has a size of 77 bytes.

This is not always accurate because a text file does not store only characters, but also information about the format to display those characters. In addition, programs can use compression methods to represent the same information in a more compact form, however in the case of the notepad, the weight of the information is usually proportional to the number of characters, especially if there are only common characters.

What is a Bit at the Hardware level?

It is said that computers work with ones and zeros, this is true at a theoretical level, but physically the bits are implemented with voltage levels, think of the lamp in a room that is turned on or off with a switch, when the switch is open, electricity does not flow and the lamp is off, when the switch is closed, electricity flows and the lamp is turned on, this example is similar to what happens inside the digital microchips, where there are extremely small switches (the size of dozens of atoms and every time they try to make them smaller) that open or close in a controlled manner, ie prevent the passage of electricity or allow it, in other words at the output of that switch we can have a 0 or a 1. These small switches are called TRANSISTORS.

Microprocessors are systems made up of millions of transistors. Using transistors it is possible to create logic gates, from the most basic gate which is an INVERTER that implements the logical operation NOT, that is to say if the input is 0 the output will be 1, to more complex gates such as the XOR gate, that given two input bits, the output will be 1 if and only if one of the inputs is 1. In addition these logic gates are grouped in increasingly complex digital systems to form flip flops, counters, adders, shift registers or memory blocks.

RAM is another example, a block of volatile memory, which stores bits temporarily to assist the processor with its tasks.

The hard disk stores bits in the form of magnetic fields using the magnetic hysteresis property of some materials, while solid state disks store information in flash memory blocks, with no moving parts.

Conclusion

A bit is a binary digit that can be worth 0 or 1, it is part of a numeric system analogous to the decimal system we use, the binary system, in which instead of having 10 numbers, we have two.

The bit is the basic unit of information used in computing. By grouping bits into binary words, all kinds of data such as numbers, text, images or sounds can be represented, i.e. information can be digitized.

The bit is a concept that is applied at the software level to analyze the information and logical operations that are performed. In microprocessors this translates physically to voltage levels or magnetization in the case of magnetic hard drives.

Secured By miniOrange