PC Hardware

How Microprocessors Work

Current CPUs, such as the Intel Pentium III, are collections of millions of switches and bus pathways. They operate all kinds of machines, in addition to PCs, and are found in cameras, cars, microwave ovens, TVs, and all kinds of gadgets. Here, however, we are interested only in how they work inside a PC. Let's look at a simple task: adding two numbers such as 2 and 2 together and obtaining their sum (2 + 2 = 4). The CPU can do math problems very quickly, but it requires several very quick steps to do it. Knowing how a CPU performs a simple task will help you understand how developments in PC design have improved PC performance.

When the user pushes a number key (in a program like Calculator, which can add numbers), the keystroke causes the microprocessor's prefetch unit to ask for instructions on what to do with the new data. The data is sent through the address bus to the PC's RAM and is placed in the instruction cache, with a reference code (let's call it 2 = a).

The prefetch unit obtains a copy of the code and sends it to the decode unit. There it is translated into a string of binary code and routed to the control unit and the data cache to tell them what to do with the instruction. The control unit sends it to an address called "X" in the data cache to await the next part of the process.

When the plus (+) key is pressed, the prefetch unit again asks the instruction cache for instructions about what to do with the new data. The prefetch unit translates the code and passes it to the control unit and data cache, which alerts the ALU that an ADD function will be carried out. The process is repeated when the user presses the "2" key.

Next (yes, there's still more to do), the control unit takes the code and sends the actual ADD command to the ALU. The ALU sums "a" and "b" are added together after they have been sent up from the data cache. The ALU sends the code for "4" to be stored in an address register.

Pressing the equal sign (=) key is the last act the user must execute before getting the answer, but the computer still has a good bit of work ahead of it. The prefetch unit checks the instruction cache for help in dealing with the new keystroke. The resulting instruction is stored, and a copy of the code is sent to the decode unit for processing. There, the instruction is translated into binary code and routed to the control unit. Now that the sum has (finally) been computed, a print command retrieves the proper address, registers the contents, and displays them. (That involves a separate flurry of activity in the display system, which we won't worry about.)

As you can see, a microprocessor must go through many more steps than human beings are required to take, merely to arrive at the conclusion that 2 + 2 = 4. The computer must execute a complicated dance in order to manage the code, place it, and fetch it in memory; then it has to be told what to do with it. Yet the result usually appears as fast as you can type the request. You can see that clock cycles and, hence, processor speed, have a significant effect on performance. Other issues that affect performance include memory access and speed, as well as the response time of components such as the display system.