In today’s world, we are surrounded by computers everywhere – they are in our cars, in our pockets, and even in our smart fridges. However, despite using these devices so frequently, many people are still unaware of how exactly they enable you to perform tasks that would have seemed impossible not long ago.
In essence, all computers are just fancy calculators (and therefore calculators are simple computers) - in fact, the word ‘computer’ used to be a job title for someone who did calculations, or ‘computing’ before the devices were around, and gradually replaced the human computers. They perform binary calculations, meaning that each number is either a zero or a one. This is done through the use of tiny switches, called transistors, which either block current/allow a very weak current to flow (zero) or allow a strong current to flow (one), but can be operated electrically without any moving parts. Inside modern computers, there are billions of transistors.
However, the computer needs a way to perform more complex operations on these ones and zeroes – this is where logic gates come in. Logic gates are arrangements of transistors in conjunction with resistors and diodes, which can take inputs, and output values depending on the type of gate and the input (all possible inputs and outputs are one or zero since current computers work in binary). Usually. there are 7 gates which are known as the ‘basic gates’, known as AND, OR, XOR, NOT, NAND, NOR and XNOR:
- In an AND gate, two inputs are taken, and both inputs must be ‘True’ (value of 1 in binary/strong current flowing) to return ‘True’, hence the name AND – input A and input B must be ‘True’ to return ‘True’.
- An OR gate only requires one of its two inputs to be ‘True’ to return True, but it also returns ‘True’ if both inputs are ‘True’ (input A or input B must be ‘True’ to return ‘True’).
- In an XOR gate, the X stands for exclusively, meaning that it functions in the same way as an OR gate, apart from when both input values are ‘True’: in this scenario in an OR gate, the output would be ‘True’ since at least one of the inputs is ‘True’. However, an XOR gate returns ‘False’, demonstrating that it is exclusively OR in the sense that it will output ‘True’ exclusively when either input A or input B is ‘True’, but not both.
- The NOT gate is the easiest gate to understand, as it only takes one input and has one output, and it simply flips the value of the input – since there are only 2 possible values in binary, it outputs the value that is not the input value.
- The NOT gate is used in conjunction with the three gates that are explained above to form 3 more ‘basic’ gates (the NAND, NOR, and XNOR gates), with the ‘N’ in their names representing the NOT. These function in exactly the same way as their regular counterparts, but with all the values being flipped, due to a NOT gate being added onto the output to flip the result once the operation has been completed by the AND, OR, or XOR gate.
These logic gates can then be organized into larger structures to perform increasingly complex calculations. Most modern-day computers contain certain specialized components which enable them to operate, which are jam-packed full of logic gates and transistors. The CPU (Central Processing Unit) is responsible for receiving instructions from programs (code), executing the instructions, and then outputting instructions to the rest of the computer. These instructions are stored in memory (most commonly RAM (Random Access Memory) in modern computers), as it is responsible for storing all the instructions from apps (applications) that are currently running so that the CPU can execute them so they can function. In order to see these apps that are being executed, the GPU (Graphics Processing Unit) handles all the graphics rendering and outputs it to the screen. And all the files and apps that you’re using are stored on your secondary storage, most commonly an HDD (Hard Disk Drive) which stores ones and zeroes as tiny changes in the direction of magnetization of parts of a spinning disk (spinning at either 5400 or 7200 revolutions per minute), or an SSD (Solid State Drive), which manipulates electrical charges and stores them, then detects their presence/absence as ones/zeroes.
So next time you load up TikTok, or your favourite video game, or get in your car, just remember that billions of ones and zeroes are being processed billions of times every second in billions of tiny wires/spinning magnetic disks/silicon electron stores inside different parts of your device, just for your convenience.