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
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.
The arithmetic logic unit (ALU) performs all the basic arithmetic, logical or input/output operations.
Used as storage and it has two types of memories:
- Random Access Memory (RAM)
- Read Only Memory (ROM)
RAMrandom 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.
ROMread 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)
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).
The MAR holds the memory address of:
- the data to be used by the ALU - so that the ALU can fetch the corresponding content from the memory and process it accordingly.
- 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
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 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)
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
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.
- Fetch instruction from primary memory to control unit
- Decode instruction in control unit
- Execute instruction
- Store result of execution and check for next instruction
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.
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.