To illustrate how the computer works, let's take a very simple example. Let's suppose you are working in your word processor and you type the letter "M". Here's what happens, in general terms, when you press the "M" button:
The keyboard sends an electrical signal, called a scan code, to the computer saying that a button was pressed.
The keyboard controller interprets the scan code and determines that the letter pressed was an "M". It stores this "M" in a special memory location until the processor is ready to deal with it.
The controller sends a signal to the processor, called an interrupt. An interrupt tells the processor that some part of the computer has information for it to process and wants its attention. In this case, the keyboard controller wants the processor to look at the key you just pressed.
The processor is almost always doing many things, sharing its time among many tasks. As a result, most every event must wait its turn. The processor services interrupts based on their priority. When it is time to deal with the keypress, the processor routes it to the program for the operating system that you are using.
Assuming you are using a multi-tasking operating system like Windows, the operating system software decides which window you pressed the key in and sends a message to that window telling it a key was pressed.
The window decides what to do with the keypress. Since in this case it's your word processor window, and the key you pressed was an ordinary letter, the word processor will add that letter to its working area for the file you have open. The letter will take one byte of your computer's memory (RAM). Other keys could be handled differently (for example, if you pressed the key to tell the word processor to exit).
The window will then call the operating system to display the letter on the screen.
The operating system will display the letter on the screen by adding it to your video card's video memory.
The next time the video card refreshes your monitor (re-displays what is in its video memory) the letter will appear on the screen. Most video cards refresh the monitor between 60 and 100 times per second.
Wow, a lot happens even in a simple example like this! This all appears to occur instantaneously because the computer is simply operating at a much faster speed than humans can readily perceive. But despite the illusion created by the speed of the PC, a lot of activity is going on inside the box for even the most basic activity.
In fact, even in the description above, I omitted many steps and details. To list every single step could take dozens of pages, even for just this simple example! The processor itself is handling many thousands of chores every second, and every part of the computer has a job to do on an ongoing basis. This hopefully gives you some idea of how the computer processes, moves, and stores information. Notice that in this example all three activities occurred.
No comments:
Post a Comment