How do computers KNOW what zeros and ones actually mean?

1.42K 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

I’ll explain in my own way, maybe someone else has as well, too many responses to read.
The computer only “knows” what a string of ones and zeroes is (called a byte, the ones and zeroes called bits) refers to because at that point, it expects something in particular.
Say you are using a word processor. You press a key. The keyboard creates the string associated with that character. For instance, the letter A is the following 8-bit string: 01000001. The letter B is 01000010 and so forth. There’s another signal that is sent which is called an interrupt signal. It tells the computer something external is going on, in this case, a key was pressed. When that happens, it goes to the program that handles the keyboard interrupt. This program is part of the Operating System. The value in binary (the 01000001 string for A) is stored somewhere in memory and control is passed back to the program running, at the point it left off. In a word processing program, most of its time is spent waiting for a key to be pressed. It’s a small routine that cycles basically checking if there is new data in the memory location that holds the value of a key that was pressed. If that location is not empty, it acts on the value stored. If you pressed A, it then goes off to the display routine that actually puts an A on your screen. If it was Alt-S, it checks to see what that code means (Save) and goes to the routine that saves your work on a file and then comes back, resetting the value in memory, ready and waiting for the next key to be pressed.
Another software uses the strings differently because that’s how it is programmed. It may also be 01000001 but in this case, the string means something different and the program does whatever it was told to do with that string. A spreadsheet sees that string and at that point in the program, it may be told to add it to another string. It doesn’t “know” it’s a number, it just does what it’s told to do with it. That same string of bits in another area of the memory may mean to the program that this is the color red to show on your screen.
The table or maze you allude to is the memory. Each program (application) is assigned some memory to run in and use for its data. The programs are told to look in their specific block of memory only, that’s where its data will be. The program controlling your screen knows that all the data needed to actually create what you see on the screen is in a certain memory area. The bits and bytes there represent the data to do so, from the color to the brightness of each pixel. If another program accesses that memory location, it would read it and do what it is told to do with the byte but the result may not make any sense, it may even crash the computer.
Does that clear things up?

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