Central processing unit
A Central Processing Unit (CPU) is the main control mechanism of a computer, containing control logic, registers, and arithmetic logic unit (ALU) as well as a memory interface. Some CPUs implement additional functionality, but often other capabilities are provided through peripheral processors that handle such things as input/output (I/O), floating-point arithmetic, and vector processing. All computers contain at least one CPU, but some contemporary computers contain over 1,000.
The purpose of a CPU is to execute programs. Programs are a series of numeric values, where each value indicates a specific operation. Each value is referred to as an instruction, and has a corresponding mnemonic for programming convenience. These values are known as machine code. All of the instructions that can be executed by a CPU are collectively known as the CPU's instruction set. Different CPU models usually implement completely different instruction sets, so that programs written for one CPU will not execute on a different one. Writing programs in machine code is difficult, so programs called assemblers were written to translate mnemonics into machine code, thus increasing the speed of writing, and the reliability of, programs. Since the 1960s, most programs have been written using a Programming Language, which are even easier to use than an assembler.
A microprocessor is any processor implemented on a single integrated circuit, however most microprocessors are CPUs. The largest producer of microprocessors used in general-purpose computers is Intel.
The basic operation of a CPU is the "Fetch, Decode, Execute" cycle. The instruction fetcher fetches instructions from memory. The control logic decodes and executes the instruction. The ALU is used to perform arithmetic and logical operations such as adding a value in memory to a value in a register and storing the result in another register. On some CPUs, some instructions may require additional fetches from memory (e.g., to get or store operands). A program in memory is executed sequentially, with each instruction stored in a different memory location. The instruction pointer (IP) register keeps tracks of the current program position, and is updated (usually incremented) after each CPU cycle.