A processor is made out of transistors. You can think of a transistor like a light switch, where when you flip it it lets electricity flow. If you hook two together, you can create “AND,” logic where both switch A *and* switch B have to be flipped in order for electricity to pass. We call these “logic gates,” and we can do other configurations for OR gates, and so on, building some complex logic.
An entire microchip is made out of billions of these transistors all set up almost like dominoes, where if a certain set of “input,” transistors are turned on, they change the path electricity takes through the chip, usually switching other transistors in the process. Each of these input configurations is called an “instruction,” and is usually represented as a bunch of 1s and 0s (1 for “on,” and 0 for “off.”). A single instruction might be “ADD 1, 2” where the instruction “ADD” switches the process to ADD mode, which means next two binary numbers it gets (0001 and 0010 in this case) will be sent to the part of the circuit that handles adding numbers.
When we program, we *could* type in the 1s and 0s, but that would be ridiculous. Instead we type in a programming language (the if/then/unless logic you mentioned in your post) and that gets “compiled,” to the binary instructions that the processor can understand.
Latest Answers