Back to basics: Basics of Computer Architecture
Back to basics: Basics of Computer Architecture

Back to basics: Basics of Computer Architecture

Dec 12, 2022
notion image

Architecture of the CPU (Central Processing Unit)

CPU: The “brain” of the computer system that performs basic arithmetic, logical or input/output operations to process data quickly
CPU contains the following:
  • Control Unit (CU)
    • Memory Address Register (MAR)
    • Memory Data Register (MDR)
  • Arithmetic Logic Unit (ALU)
  • Primary Memory

Control Unit (CU)

The control unit (CU) is responsible for the operation of the CPU. It controls the retrieval of instructions from the primary memory as well as the sequence of their execution.
The CU is responsible for providing the ALU with the data that needs to be processed as well as the instructions of how the data should be processed.

Arithmetic Logic Unit (ALU)

The arithmetic logic unit (ALU) performs all the basic arithmetic, logical or input/output operations.

Primary memory

Used as storage and it has two types of memories:
  1. Random Access Memory (RAM)
  1. Read Only Memory (ROM)
RAM random access memory
The RAM stores the executing program instructions as well as any data that is needed. Instructions and data in the RAM are stored in unique memory locations, each location has an address as well as content.
The unique memory location is used by the CU to find, retrieve and access the data so it can send it to ALU for processing,
The content is where the instructions and data reside.
ROM read only memory
ROM holds instructions and data in unique memory locations, just like RAM. Every such location has an address as well as content.
Unlike the RAM however, the ROM is used to store permanent instructions and data that cannot be changed and are used to boot and operate the computer. As such, nothing can be altered in the ROM.
Difference between RAM and ROM
Can be overwritten, altered
Cannot be altered
general—purpose storage area: programmings running and the data used
Used to store permanent instructions and data that cannot be changed such as (BIOS) Basic Input / Output System, commands for the operating system
Volatile (can be lost)
Non-volatile (cannot be lost even when power is down)
notion image
The CU contains various registers.
What is a register?
A register is a small storage location that can hold data, usually a multiple of 8 bits. For example, a 64 bit computer has 64 bit registers.
The basic registers in the CU are the memory address register (MAR) and the memory data register (MDR).

Memory Address Register (MAR)

The MAR holds the memory address of:
  1. the data to be used by the ALU - so that the ALU can fetch the corresponding content from the memory and process it accordingly.
  1. the memory address of where data that has been processed will need to be stored
Memory (Address) Bus: The connection between primary memory and MAR

Memory Data Register (MDR)

The MDR holds the data that is to be used by the ALU and then saved to the RAM.
whichever memory address location the MAR is holding, the corresponding data will be loaded onto the MDR for processing by the ALU.
After the processing has taken place, the ALU places the result onto the MDR and the data is copied to the memory address location in RAM specified by the MAR.
Data Bus: The connection between the RAM and the MDR

Cache memory

Cache holds the information from the RAM that is most actively used, and accessed most frequently
RAM has two main types:
  • Dynamic RAM (DRAM)
  • Static RAM (SRAM)
Slower, inexpensive
Faster, more expensive
DRAM is preferred for the main RAM of a computer system.
SRAM is preferred to act as cache
stores instructions and data for longer than SRAM or cache
temporarily stores instructions and data
notion image
Types of cache: L1 cache and L2 cache.
L1 cache is placed on the microprocessor itself whereas
L2 cache is placed between the primary memory and the microprocessor.

The machine instruction cycle

Four steps:
  1. Fetch instruction from primary memory to control unit
  1. Decode instruction in control unit
  1. Execute instruction
  1. Store result of execution and check for next instruction

Secondary memory and the need for persistent storage

Persistent storage is needed to store data in a non-volatile device during and after the running of a program.
Secondary memory (a.k.a. secondary or auxiliary storage) is a relatively slow memory that may be written to (just like the RAM) but is also non-volatile (just like the ROM); meaning that the contents of the memory are not wiped if power is lost but are persistent.
That is why secondary memory is also known as persistent storage. It has a relatively high capacity to hold data compared to the primary memory.
notion image
When the computer starts-up the RAM is empty. Instructions and data (such as the operating system) need to be copied into the RAM in order for the computer system to run. In most computer systems these are copied from the secondary memory. Secondary memory is thus what provides persistent storage to computer systems. This is very important since if secondary memory did not exist a computer system would be unable to store instructions and data persistently. Whenever it shut down all the contents of the only existing primary memory would be lost.


  • International Baccalaureate Organization. (2012). IBDP Computer Science Textbook.