How do computers *really* work? (at the most basic level)
This is a complex matter. To begin with, when you move your mouse, there is so much going on at once, that I cannot even begin to explain everything here. So, I will focus on the most fundamental thing: How does the computer actually compute?
As you are probably familiar with, computers have memory called RAM, and a CPU that is able to execute &quot;commands&quot;. Commands, are essentially some form of data, that allows the computer to decide which logic gates to pass the input to.
At its core, this is the work of the ALU in the CPU. ALU stands for Arithmetic Logic Unit, and it had three inputs, contrary to what you may think. The first two inputs are normal inputs for the operations, for example: two numbers $a,b$ that we want to sum up. The third input, decides what operation to do on them. For example, you can encode that &quot;0001&quot; means we want to sum the two numbers, while &quot;0010&quot; might mean multiplication and &quot;0011&quot; is division. This ALU does this magic!
This &quot;magic&quot; that decides based on the third input which operation to do, is done via applying a multiplexer circuit to take the output from the correct series of logic gates in the ALU.
Basically, an $n$-to-$1$ multiplexer is given $n$ &quot;normal&quot; inputs, and one &quot;special&quot; input that decides which of the $n$ inputs to output. Yes, it simply outputs one of its inputs without changing anything. Basically, if we think of its inputs as an list $inp$, and the &quot;special&quot; input is called $s$, then the output is $inp[s]$.
The ALU takes this, and gives to it as the $inp$ the list of all possible operations on the two numbers $a,b$, and thats how the ALU knows which operation to apply when.