Computers: Central Processing Unit (CPU)

    Computers: Central Processing Unit (CPU)

      If the different parts of a computer had their own mottos, the Central Processing Unit's would be something like

      Its job is to keep everything running in the computer, directing traffic wherever it needs to go. From its position on the motherboard, the CPU moves memory around and follows the instructions in a piece of code.
      (Source)

      It's basically the control center of a computer. From its configuration of micro-electronic circuitry (microchips), the CPU follows or executes the instructions sent in by a program or piece of software. You might also hear the CPU called the microprocessor or the processor because…it processes things.

      Since the CPU is chock full of electrical pieces and those pieces hold electrical charge, it can get pretty hot in there. Too hot, sometimes. If you ever hear a whirring in your PC, that's probably a fan trying to cool down your CPU. If your computer builds up too much dust (or you upgraded the computer with a nice graphics card), the fan might not be enough to cool down your computer. If the fan can't cool down the CPU, your computer's going to shut down when the CPU gets too hot.

      That's a good thing, believe it or not. If your computer didn't do that, we don't like to think what kind of meltage would happen to your computer. Still, you should clean your computer regularly to avoid it.

      Parts of the CPU—called registers—act like storage despite not actually being storage. Registers hold data for small amounts of time while the CPU moves memory around to run a program. If you want the computer to let data sit around for a while, don't let it sit in the register. The register's too active for that, holding the results of computations or data addresses. Save the long term storage for the less-volatile memory, thanks.

      The thing that makes the CPU tick, though, is the control unit, which uses electronic circuits to direct traffic. This isn't the part that executes program instructions. Instead, it tells other parts of the system to run those instructions and where to find the data they'll need. To direct all those parts, the control unit needs to retrieve the program instructions from memory and based on what the instruction is, move the matching data into the second part of the CPU, the Arithmetic Logic Unit (ALU).

      The ALU is a group of electronic transistors (electronic gates managing the flow of electric current) that calculate basic arithmetic and make comparisons of different pieces of data.

      The keyword for the ALU's arithmetic is "basic." Could computers do more than basic arithmetic? Sure, but it'd cost them. When the ALU's designed to run more complex math functions, it becomes much less efficient. It's slower and it takes more CPU time. Instead, the CPU breaks down complex math into multiple, simpler problems. That way, the multiple simple problems run faster than the fewer complex problems.

      No, seriously. Say you want your computer to calculate 65. Instead of solving that problem all in one calculation (which, let's face it, isn't how you'd solve it if you didn't have your $600 calculator right there), the CPU's going to break it down into multiple steps:

      1. = 6 * 6
      2. A = A * 6
      3. A = A * 6 
      4. = A * 6.

      That's what the CPU's there for, after all: to control problems so that they can be solved simply and easily by the computer. It's going to store and grab all of the intermediate operations in different registers as the 65 problem gets broken down and solved.

      The least you could do is blow some compressed air on it once in a while.