The CPU of a computer, or central processing unit, is frequently compared to the human brain since it's the central control of the computer. The CPU performs computer operations by rapidly executing program instructions. The speed of the CPU plays a large part in determining the power of a computer. Each new generation of microprocessors features a more powerful CPU that can execute instructions more quickly than the previous generation.
How a Computer Processor Works
The working of the CPU is defined as a three-step process. First, an instruction is fetched from memory. Second, the instruction is decoded and the processor figures out what it's being told to do. Third, the instruction is executed and an operation is performed. These three steps repeat in a cycle that begins again with the CPU fetching the next instruction. The steps are referred to as the instruction cycle of the CPU.
Video of the Day
The CPU uses a program counter to keep track of which instruction to fetch next. The counter is the address of the memory location that holds the next instruction to be executed. It's stored in a register, which is a dedicated memory location in the CPU itself. The program counter is incremented to point to the next instruction after each fetch in the instruction cycle.
Operations Performed by a CPU
The CPU executes instructions that perform a set of basic operations. There are arithmetic operations like addition, subtraction, multiplication and division. Memory operations move data from one location to another. Logical operations test a condition and make a decision based on the result. Control operations affect other components of the computer. These basic types of operations, executed very quickly, allow a computer to perform a wide range of functions. The exact number of operations supported by a CPU depends on its architecture.
How the CPU Uses Memory
Computer memory refers to the area where data and programs are stored. Memory is not part of the CPU, but the CPU must interact closely with it. There are two types of computer memory: primary, or main, and secondary. The CPU relies heavily on main memory for storing program instructions and the data the instructions operate on. Main memory is temporary in nature and only holds instructions and data for a program while the program is executing. Secondary memory is the more permanent storage provided by hard drives and flash drives.
A component of the CPU known as the control unit is responsible for moving instructions and data from secondary storage into main memory prior to instruction execution. The control unit also moves the results of an instruction to secondary storage.