Table of contents
1.
Introduction
2.
About CPU
3.
Instruction cycle of CPU
3.1.
Fetch
3.2.
Decode
3.3.
Execute
4.
Components of CPU
4.1.
Memory Unit
4.2.
Control Unit
4.3.
Arithmetic and logical unit
4.3.1.
Arithmetic unit 
4.3.2.
Logical unit 
5.
Frequently Asked Questions
5.1.
What is the difference between RAM and ROM?
5.2.
How many instructions per second can be executed by a modem CPU?
5.3.
How is the speed of a CPU measured?
6.
Conclusion
Last Updated: Mar 27, 2024
Easy

Central Processing Unit (CPU)

Author Md Yawar
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

A computer is an electronic device that can take input from the user, process it, and shows us the output. A computer is comprised of various parts, each with its own function. In this blog, we will talk about the central processing unit (CPU), known as the brain of the computer.

source

About CPU

CPU is the primary component of the computer that processes information. It runs the operating system and the applications. It allows the input and output devices to communicate with each other.

CPU has at least one processor that performs calculations. Modern CPUs generally have more than one processor. A CPU with two processors is called a dual-core CPU, and one with four processors or cores is called a quad-core. High-end CPUs have six cores, and eight cores called hexacore and octa-core, respectively. Modern CPUs are susceptible to overheating and are often covered with heat sinks and thermal paste.

Source

Instruction cycle of CPU

The actual work performed by the CPU is to execute a sequence of instructions called a program. The instructions are stored in the computer’s memory. Almost all CPUs follow the fetch, decode, and execute steps, collectively named the instruction cycle.

Instruction cycle of a CPU

Fetch

The first step is to fetch an instruction. The instruction is stored in the computer’s memory. The location of the instruction is determined by the “program counter” or “instruction pointer”. Program counter stores a number that identifies the location of the next instruction

Decode

CPU will perform according to the instructions fetched from memory. A binary encoder then decodes the instructions. The binary encoder converts the instructions to signals that control the other parts of the CPU.

Execute

After decoding the instructions, the CPU executes the instructions. During this step, Control signals electrically enable or disable various parts of the CPU to perform the desired operation.

Block diagram of a uniprocessor CPU

Components of CPU

There are three main components of the CPU:

  1. Memory Unit
  2. Control Unit
  3. Arithmetic and Logical Unit

Source

Memory Unit

The memory unit is also called the storage unit. It stores the instructions, data, and immediate results. It is responsible for transferring information to the other units of the computer. It is the primary storage of the computer and is also known as Random Access Memory (RAM).

RAM

Control Unit

It controls the operations performed by the computer. It extracts the information from memory and then decodes and executes them. After decoding the information, it tells the Arithmetic and logical unit the operations it needs to perform and then sends the processed data back to memory.

Alsource

Also read, microprogrammed control unit

Arithmetic and logical unit

Arithmetic and logical unit (ALU) performs the actual arithmetic and logical operations inside the CPU. The control unit provides the instructions to the ALU that it needs to perform. ALU performs these operations by connecting transistors and then stores the result in an output register. As the name implies, ALU is comprised of two parts:

Arithmetic unit 

It performs all the arithmetic operations such as addition, subtraction, and multiplication. ALU also performs complex operations by combining these arithmetic operations.

Logical unit 

Selecting, merging, comparing, and matching the data is performed by the logical unit.

Source

Must Read hardwired and microprogrammed control unit and Difference Between Verilog and Vhdl

Frequently Asked Questions

What is the difference between RAM and ROM?

RAM stands for random access memory, and it stores the files that are used by the computer in real-time. It is volatile memory, and the data on it can be modified. ROM is Random Access Memory and is non-volatile, i.e., the data on it remains as it is even if the computer is switched off. Data on ROM cannot be modified.

How many instructions per second can be executed by a modem CPU?

A modern CPU can execute around a million instructions per second.

How is the speed of a CPU measured?

The speed of the CPU is measured by calculating the number of cycles the CPU executes per second. It is measured in gigahertz (GHz).

Conclusion

This blog talks about the central processing unit (CPU). We looked at its different parts and understood how they work together to execute an instruction.

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem DesignMachine learning, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! But if you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc. You must look at the problemsinterview experiences, and interview bundle for placement preparations.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Live masterclass