A central processing unit (CPU) known as a central or main processor, is an electronic part within a computer that executes instructions by the user. CPU consists of two components ALU & CU that handle arithmetic, logic, controlling, and input/output (I/O) operations as per instructions.
What is Central Processing Unit?
Central Processing Unit is an electronic component inside the computer that handles and processes all instructions it receives from hardware and software running on the computer. It is the combination of two parts ALU & CU. It is also called a processor.
CPU is mounted on the motherboard. It carries out most of the work of a computer. Data comes from RAM and other units such as keyboards and drives pass through CPU continually. CPU processes the data and sends it back to RAM and also to other units.
CPU continually receives instructions to execute. Each instruction tells the CPU to process data. Furthermore, CPU performs all operations on data according to the given instructions. It executes instructions and tells other parts of the computer what to do. Most of the work consists of calculations and data transfer.
Components of Central Processing Unit
A CPU is the combination of two major components that are ALU (Arithmetic and Logic Unit) and CU (Control Unit). Both parts have unique functionality. It tackles arithmetic and logical operations while CU is responsible to control all activities of a computer.
ALU (Arithmetic and Logic Unit)
ALU is a part of the CPU. The actual execution of the instructions takes place in this part. All arithmetic and logical operations are performed in ALU. Furthermore, ALU further has two units that are Arithmetic Unit and Logic Unit.
The Arithmetic unit of the ALU performs basic arithmetic functions such as addition, subtraction, multiplication, and division also. The Logical unit of ALU carries out logical operations such as a comparison of two data items and also to find which data item is greater than, equal to, or less than the other.
The control unit is also called the supervisor of the computer that controls all activities of a computer system. CU fetches instructions from main memory, interprets that instruction to find what operation is to be performed and controls the execution of the instruction.
A register is a small high-speed memory inside the CPU. It is used to store temporary results. Registers are designed to be assessed at a much higher speed than conventional memory. Some registers are general purpose while others are classified according to the function they perform.
Types of CPU
There are two main types of central processing units that are dual-core processor and a quad-core processor. A CPU that has two joint processors is called a dual-core processor and the CPU that is the combination of four processors joint together is called quad-core processor.
Four Functions of CPU
Central Processing Unit performs the following four functions:
Fetch: Instruction fetch is a process of getting instruction from the memory to execute it. This process is performed by the control unit.
Interpret Instruction: Interpret instructions is a process to examine the nature of the instruction to determine what further operation should be taken. If any operation is needed, it should be carried out before the execution of that instruction.
Execute Instruction: After interpreting the instruction and getting the required data, CPU finally executes that instruction. The instruction is executed by ALU.
Storing: the process of writing the result to the memory is called storing.
These four operations collectively are called a machine cycle or instruction cycle also. The time required to fetch and decode instruction is called instruction time or i-time. The time required for executing and the store is called Execution time or e-time.
Instruction Set of Processor
The set of all instructions that a CPU can perform is called an instruction set of the processor. The important types of instructions inside in an instruction set are Arithmetic Instructions, Logical Instructions, Data Transfer Instructions and Control Transfer Instructions.
The instructions that are based on digits or arithmetic values used to perform arithmetic operations are called arithmetic instructions. Different arithmetic operations are additions, subtraction, multiplication, and division. These instructions are executed by the arithmetic and logic unit of the CPU.
The instructions used in order to perform logical operations are called logical instructions. A logical operation is the comparison of two data values. Furthermore, the possible comparisons are Greater than (>), Equal to (=), Less than (<). Furthermore, these instructions are also executed by the ALU.
Data Transfer Instruction
The instruction used to transfer data from one component to another component during program execution is called data transfer instructions. These instructions are used for quick delivery of data between computer components to make program execution more reliable and efficient.
Control Transfer Instruction
The instruction used to change the sequence of instructions of a program is called control transfer instructions. These instructions transfer the execution control to a certain part of a program instead of the next instruction