As mentioned above, the CPU is the brain of a digital system such as a PC. It handles all of the basic logical and arithmetical operations which are carried out in order to process the information required. In a PC there can be one or more CPUs present, multi-core processors which are common these days, actually have two or more CPUs on the same chip. Another CPU setup is referred to as multiprocessing, which consists of 2 or more separate CPUs that work in unison to effectively double (or quadruple with 4 CPUs) the processing power.
The majority of CPUs process data in 4 stages: Fetch, Decode, Execute and Writeback.
The first step in the process is to actually fetch the instruction that is to be processed, this involves the CPU querying the system's memory to retrieve the binary data (0's and 1s).
This stage involves the CPU decoding the instruction and separating it into parts which are relevant to each of its components (see below).
This is where all of the components of a CPU come together in unison. If, for example, the instruction received was a simple mathematical equation then the CPU will invoke the ALU (see below) to perform the calculation.
This final stage involves the CPU writing the result of the instruction (in our example the result of a simple sum) into a specific location in the memory. Depending on the instruction, this result may be written to the CPUs own registers for further processing, or in some cases written directly to the system's main memory. The result for some instructions may require the CPU to alter the state of data in the flags register, or, in what is referred to as a jump
, increment or decrement the program counter.
- CU - Control Unit, this sequences, controls and times the other functions of the CPU.
- ALU - Arithmetic Logic Unit, this carries out simple mathematical equations on the binary data stored inside the data registers.
- Registers - these are temporary memory locations which hold binary data and store the results of ALU calculations. There are also memory address registers which, as the name suggests, hold data concerning where in the memory certain instructions and data is held.
- BUS - this carries data between the memory and registers.