What Are the Functions of a CPU in a Computer?

Techwalla may earn compensation through affiliate links in this story.
Image Credit: Denis83/iStock/GettyImages

People frequently describe a computer's CPU in terms of the human brain. This is an apt analogy since the CPU (central processing unit) controls computer operation. It does this by executing instructions provided by computer programs on data that come from a variety of sources.


What Is the Function of a CPU?

The purpose of every computer is some form of data processing. The CPU supports data processing by performing the functions of fetch, decode and execute on programmed instructions. Taken together, these functions are frequently referred to as the instruction cycle. In addition to the instruction cycle functions, the CPU performs fetch and write functions on data.


Video of the Day

CPU Instruction Cycle Functions

When a program runs on a computer, instructions are stored in computer memory until they're executed. The CPU uses a program counter to fetch the next instruction from memory, where it's stored in a format known as assembly code. The CPU decodes the instruction into binary code that can be executed. Once this is done, the CPU does what the instruction tells it to, either performing an operation, fetching or storing data or adjusting the program counter to jump to a different instruction.


The types of operations that typically can be performed by the CPU include simple math functions like addition, subtraction, multiplication and division. The CPU can also perform comparisons between data objects to determine if they're equal. All the amazing things that computers can do are performed with these and a few other basic operations. After an instruction is executed, the next instruction is fetched and the cycle continues.


CPU Data Functions

While performing the execute function of the instruction cycle, the CPU may be asked to execute an instruction that requires data. For example, executing an arithmetic function requires the numbers that will be used for the calculation. To deliver the necessary data, there are instructions to fetch data from memory and write data that has been processed back to memory. The instructions used by the CPU and the data it operates on are stored in the same memory area. Unique addresses are used by the CPU to keep track of different memory locations.


Microprocessor CPUs

The microprocessor of a personal computer is a chip that contains all the circuitry necessary to control computer operations. It allows every function of the CPU to be executed by a single chip that is cheaper to manufacture and more reliable due to the use of integrated circuits. Prior to the introduction of microprocessors, a computer's CPU was contained on a circuit board that contained multiple chips connected by integrated circuits. Today, many modern processors have several CPUs on the same chip, referred to as cores.