Imagine a huge square, 100×100, of lightbulbs. Each lightbulb can be only ON or OFF, but together, depending on which lightbulbs are ON, they can create shapes that you will perceive as letters or numbers for example. The computer reads which lightbulbs (transistors on the chip) are on, and shows you on the screen what it perceived.
It starts with setting up a binary system. You can do it anyway you like, but binary (two possible states per signal) is robust and works well with electricity. You define for example 5V to be 1 and 0V to be 0. Then you get a bunch of logic gates. The basic building block for a logic gate is transistors. For example, an AND gate outputs a 1 if both inputs are 1, and 0 otherwise.
Now put a bunch of gates together and add a clock signal. Now you can feed sequences of 1’s and 0’s into your logic network at the pace of the clock. You can make a network that lights a little lamp every time the sequence “0011” is fed into the network. You can make the sequence “1100” light a different lamp. You can make the sequence “0000” turn off both lamps. You can make “1111” mean do nothing.
0011 1100 1111 1111 0000
According to what we’ve defined, the above would essentially be a software, a program. It would turn on lamp 1, turn on lamp 2, wait for two cycles, then turn off both lamps.
That’s how software interfaces with hardware.
Then keep improving the system over 50 years together with hundreds of thousands of other developers, and you arrive at a modern computer!
This area of expertise is called digital technology. As a fun fact: you don’t actually need electronics to make a digital computer. You can do it with literally anything that can transfer energy in any way. Sticks and levers, fluids, falling objects, sound waves. The reason we use electronics is because electrons are unbelievably tiny while still being able to carry a lot of power, while also moving that power at almost the speed of light. This allows us to make our circuits small in turn, and circuit size is directly tied to the maximum speed the circuit can operate at.
The silicon wafer with some metallic lines printed on it allows you to have logic gates with electricity. Stuff like AND, OR, XOR gates, if you have two wires in, and whatever happens to them, when they are both powered and only then, the output is powered, you have an AND gate for instance.
Now you can have arithmetic, where you will take for instance 32 wire running on parallel to define 32 bits which you (as a human) can decide represents a number between 0 and 4 million, or +-2millions (you can represent 2^32 unique values with those wires). You can use logic gates to build all the operations you want on these numbers
You can also use this principle to have memory: each bit of memory can be set and retrieved, and you can address your memory using arithmetic: give the memory unit a number (32 bits on the example below, and it will return the value of that one bit of memory.
But storing and addressing one bit at a time is tedious, so instead, you can build a memory where you will store 32bits at once, and address them as a whole. Now when provided with a 32 bit address, the memory can give you 32bits of memory back.
Now you can store and you can compute. The next thing would be to add more functionality to your core arithmetic, to build in all the functions you need, but basically, you only need a few, read memory, write memory, a loop and a conditional test.
Now how do you get another display?
Your screen is a matrix of pixels, and a pixel is basically 3 lamps (red green and blue) each lamp can be more or less bright. Let say each has 256 possible luminosity level, which are then controlled by 8 bits. A pixel is a 3 lamps so 32 bits, which can be updated by reading a number from our memory. Your monitor and gpu is doing just that, the gpu output its memory to the screen, which display what has been instructed.
It’s a very tall order to ELI5 the whole hierarchy of layers going from silicon wafers to GUI. I studied physics, microelectronics and computer science in Uni and while I might be able to explain it, it would take a lot of writing to do all the layers from transistor fundamentals through logic gates to logic circuits like adders to CPU fundamentals to kernels to OS to GUI.
But maybe the bottom layers…. so the silicon wafers printing, fundamentally it is “printing” transistors onto the silicon, and connections between those transistors. Won’t go into the printing process, but a transistor in this context is basically a switch with three terminals. When you apply a voltage across terminal 1 (the “input”) and 2, a connection is made between terminal 2 and 3 (the “output”). So you have an on/off switch, controlled by voltage. The switch can for example be used to control another (transistor) switch. And if you connect the output of that switch to the input of a preceeding switch, you can start making clever circuitry.
If you call the output of a switch, when it is connected, for 1, and 0 when it is not connected, you have made the first abstraction, from electronics voltage state, to ones and zeroes. (the states might be reversed, but that does not matter for the discussion). In a computer, these ones and zeroes are all there is, fundamentally, by means of abstract/logical building blocks.
To make it easier to think about this abstraction, we make up a number system with these ones and zeros, usually so that if you have 1 switch, in abstraction terms called, 1 bit, a you can count 0 and 1. If. But you can and will connect switches to each other in clever ways, as described, so that the circuitry can count, for instance can 1 input drive two two outputs so that you count to 4: 00, 01, 10, 11. These are all the combinations you can do with two outputs, and you can just define, in the computer terms, that that means counting to 4, and that the different output configurations mean 1, 2, 3 and 4 (usually 0, 1, 2 and 3).
It is not to hard to follow an explanations on how these switches are connected to each other, with feedbacks etc, to make up circuitry that will count, and that can add, for instance add the output of the above example to the output of another similar circuit. See for instance [https://en.wikipedia.org/wiki/Adder_(electronics)](https://en.wikipedia.org/wiki/Adder_(electronics))
From then on, it is a question of scaling. Modern CPUs contain billions of switches like this, powering not only calculation units like the described, but also temporary storage (which can also be created by the same kind of switches), and more specialized compute units.
How software interacts with this will become too long. But fundamentally, the software is made up of a sequence of instructions written out in ones and zeros and they are fed to the CPU in sequence, which trigger the inputs of the same cicuitry as above to go “high” 1 or “low” 0, to then trigger the cascade of switches in a predetermined manner, that is, determined by the exact circuitry of the CPU.
It’s not magic, it is just a very complex whole that nevertheless can be broken down into understandable, digestible chucks of electronics and logic.
Protocols.
I’m assuming you know what a logic gate is and that on the silicon level, computer can take 01010101010110101s and turn them into other 0101010101000101s.
Most of the rest is protocols. We arbitrarily, but globally agreed on what sort of electrical blips mean “hello, I am a USB device” or “hello, I am specifically a USB keyboard” or “hello, the user just pressed the letter K on the keyboard”.
But also “hello, I am a video interface. Tell me what sort of pixels you’re gonna send” the computer then says “ok listen, the next blips Imma send you are 1024 RGB values for a horizontal scanline and 768 RGB values for a vertical scanline and then that will repeat until I say otherwise”. Then the interface says “ok I’m ready lets go” The monitor then has a protocol that listens to those things and turns them into current for the display.
It’s all protocols. Basically, a computer works exactly as you would imagine. It really is an unfathomable number of teeny tiny instructions on how to turn current on and off, and an unfathomable number of unified protocols that govern how input and output devices translate these instructions to think that visually, acoustically or haptically make sense to us.
It is very much like human language. “How can humans get anything done just by flapping their mouths and tongues?” it’s because we agreed on how certain meat flapping means words and sentences and grammar, allowing us to exchange surprisingly complex ideas. Computers have words and sentences that we have taught them, that they can use to talk to their components and to us.
Let’s say we have a row of eight switches and we decide that certain combinations of off and on mean something. We could decide that they represent the letters and numbers of the alphabet, or the individual dots (called pixels) on a screen. Now imagine we could turn these switches off and on when we zapped them with a bit of electricity. This is called a transistor.
We find that when we arrange these switches into groups that we can make them do maths or simple logical operations by chaining them together in different ways. We use large banks (billions) of switches to represent things like numbers. It’s a good thing for us these switches are very small.
Once we’ve got a lot of the basic math and logical operations covered we build the switches into groups that do certain instructions like “write this number onto this other group of switches” or “send the numbers in switch group A to switch group B”. This is the CPU of the computer and those instructions are called opcodes. We use them as the fundamental building blocks of software.
We then build dedicated hardware to connect keyboard and screens to the computer and we add more opcodes that let us electrically control these things.
Opcodes are nice but it can be a lot to remember, so we build software that represents common use cases in words that are easy to understand. We bundle together all the opcodes required to print some text to the screen and we call it “print”. This is a programming language. We need some software called a compiler to turn the human readable instructions back into opcodes. People design ways to store these programs even when the power is turned off, first cards and tape with holes in them to represent the switch positions, then magnetic media like floppy disks or hard disks.
From here people use the programming language to do all sorts of things. We design a standard interfaces that let people design their own hardware and connect it to the computer and control it. From here we get mice and internet connectivity and graphics cards.
From there it snowballs and people make all sorts of things. The story of the modern computer is a story of incremental change with many people building on the work of others. We started with as box with some flashing lights on it and ended up with smartphones over the course of 40 – 50 years.
the most fundamental thing you should understand to start to get is is that computers work fast. extremely fast. modern CPUs run at 4 billion cycles per second, and most have 4 or more “cores” or physical cpu’s on one chip. so your computer can do 16 billion tasks per second. for reference on how fast that is, in the time it takes a photon of light to go from the bulb in your ceiling to the floor, your computer has done 10 or so commands.
now, every task the computer does is super simple, take number, take other number, add numbers together, display result. they are super simple tasks that get stacked together to make complex tasks. then if you work in some advanced geometry, trig, and calculus those simple commands become math to draw lines and shapes on the screen. when you move the mouse, to the computer that is glacially slow, so it can have a queue of mouse movements to handle every few thousand, or million cpu cycles and our meat brains wont even notice that the movements had to wait in line for the processor.
tldr: the cpu does at least 16 billion simple tasks every second, when you stack them all together you can draw very fancy things on the screen and process human input so fast that said human doesn’t even notice the time it takes to process
It’s a lot. The best way to get an actual understanding is to watch Ben Eater’s YouTube series on building a breadboard computer. https://m.youtube.com/playlist?list=PLowKtXNTBypGqImE405J2565dvjafglHU
This won’t cover the more advanced techniques used in modern processors and the like, but it will demonstrate the really low level functionality with extreme detail.
Latest Answers