Ok, so I know that the alphabet of computers consists of only two symbols, or states: zero and one.
I also seem to understand how computers count beyond one even though they don’t have symbols for anything above one.
What I do NOT understand is how a computer knows* that a particular string of ones and zeros refers to a number, or a letter, or a pixel, or an RGB color, and all the other types of data that computers are able to render.
*EDIT: A lot of you guys hang up on the word “know”, emphasing that a computer does not know anything. Of course, I do not attribute any real awareness or understanding to a computer. I’m using the verb “know” only figuratively, folks ;).
I think that somewhere under the hood there must be a physical element–like a table, a maze, a system of levers, a punchcard, etc.–that breaks up the single, continuous stream of ones and zeros into rivulets and routes them into–for lack of a better word–different tunnels? One for letters, another for numbers, yet another for pixels, and so on?
I can’t make do with just the information that computers speak in ones and zeros because it’s like dumbing down the process human communication to the mere fact of relying on an alphabet.
In: 264
There is a large table, created by cpu manufacturers. Every x bits (zero or one) is interpreted as a command from that table and is executed by the cpu. There is a register that always points to the current command in memory and once the cpu have executed it the register moves to the next command. When the computer starts, execution begins at the first memory spot where your booter code will load and start your operation system code.
Commands usually have a fixed length that is dependent on the brand that should be ether 8, 16, 34 or 68 bits. And some commands require additional information that comes right after it, for example, the command for adding two numbers require information about which numbers to add and where to save the results.
As for the data itself, the computer dosent inherently know what it is and if the cpu accidentally get there it will simply run it as commands (creating chaos). It’s up to the programmer to use the data in a way that makes sence. For example, if you have data representing a pixel map of an image you can tell the cpu to put that in a special place from which the screen gets data for it’s next frame. If you have data representing a letter you need to first convert it into a pixel map (probably using a font type software) before placing it where the screen reads its images.
Latest Answers