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
While most answers here are correct (or correct enough 😉), I feel they don’t really answer OPs question.
A computer “knows” what the zeros and ones mean because of their location in memory.
Computers have addressable memory. You can place zeros and ones at an address. The address is also identified by zeros and ones. You could have data “00110011” stored at address “11110011”
Some areas in memory are special and are for specific things. There is an “instruction”-area, for instance, where the current instructions for the CPU are held.
If your zeros and ones are stored in the “instruction”-area, then they are interpreted as instructions. The instruction “00000000” for instance, means “add two numbers” in most desktop CPUs. The exact instructions differ by architecture (x86 is the most common architecture for desktop PCs)
Other areas in memory are mapped to other functions and components. You could for instance have an area in memory which maps to a sound chip. The sequence “00010001” there could mean something like “play a sine wave at 8kHz”
The specific instructions and special addresses available differ by architecture. A desktop PC has different instructions and special memory areas than a GameBoy.
Latest Answers