How do computers KNOW what zeros and ones actually mean?

1.44K views

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

47 Answers

Anonymous 0 Comments

Most comments here seem to answer how a computer works, which doesn’t seem to be the question, rather how a computer knows what data represents. And the answer to that, is that, it doesn’t.

Given just a memory address it isn’t possible to know what the data at that address represents.

For example, if address 10,000 contains the number 77, there’s no way to just tell what it represents. It *could* simply be the number 77, or it could be the letter ‘M’ for which the numerical representation is 77, or it could be the operation code 77 for the `dec ebp` instruction.

There’s no way to know what data represents, except looking at the context, IE the code that uses the data.

Sometimes you can get an idea by looking at the data. For example, if you find the number 1078530011 in memory, well, that *could* just be a number that happens to be 1078530011. But, coincidentally that’s the floating point encoding for PI, so there’s a high chance it actually *is* PI. But you’d need to check the code that accessed it to be sure. If you find that every number at an address happen to decode to the text “An error occurred, please try again”, then by all odds, it probably *is* that text.

In the example of the number 77, it really could be anything. A reverse engineer would look at the code that accessed it. If the code turns out to save the most common occurrence of a letter in a word, he’ll know it represents the letter ‘M’, if code tells the CPU to execute that address, then he knows it’s the instruction ‘dec ebp’, etc.

You are viewing 1 out of 47 answers, click here to view all answers.