Introduction
Primary Storage Devices
Primary storage devices, also known as main memory or RAM (Random Access Memory), are an integral part of a computer system, responsible for temporarily holding data and instructions that the CPU (Central Processing Unit) needs to access quickly during the execution of programs. Unlike secondary storage devices, primary storage is volatile, meaning it loses its contents when the power is turned off.
Primary Storage devices include:
- L1 & L2 CPU Cache
- Random Access Memory
- GPU Cache
Characteristics
Characteristics of primary storage devices
Purpose
Primary storage devices, also known as main memory or RAM (Random Access Memory), are used to temporarily store data and instructions that the CPU (Central Processing Unit) needs to access quickly while executing programs. It is the primary working memory of a computer.
Volatility
Primary storage is volatile, meaning it loses its data when the power is turned off or the computer is restarted. This is why you need to save your work to secondary storage (e.g., hard drive) for long-term storage.
Speed
Primary storage is much faster than secondary storage. Data can be read from and written to RAM at very high speeds, allowing for quick access to the data needed by the CPU.
Capacity
The capacity of primary storage is typically smaller compared to secondary storage. It is designed to hold the data and instructions needed for the current execution of programs.
CPU Cache
CPU Cache
CPU cache is an area of memory on the cpu itself used to temporarily store data and instructions. There are commonly 2 types of cache on a CPU, L1 and L2.
L1 Cache:
- Smaller, fastest cache (16KB to 64KB)
- Very quick access times (few clock cycles)
- Stores critical and frequently used data and instructions
- Acts as a direct buffer between CPU and main memory (RAM)
L2 Cache:
- Larger than L1 cache (a few hundred KB to a few MB)
- Slower than L1 but still faster than main memory
- Serves as a secondary cache, holding additional data and instructions
- May be inclusive or exclusive of L1 cache
RAM
Random Access Memory (RAM)
RAM is a type of very fast memory that is used to temporarily hold data about currently running programs. When you load any file from the hard drive there is a lag between the request and the data being sent, this would cause massive slow down of the CPU if data was constantly being requested from the hard drive. Instead a single request is sent to the hard drive when the program loads and the whole program is loaded in to RAM. The RAM is electronic memory and all the data is stored in flop flop circuits using electrical currents and transistors. This means that there is very little latency and there the computer loads the program much faster than if it wasn’t used. However because RAM data is stored electronically, RAM is volatile – once power is lost all data is lost as well.
Cache
Cache Memory
Cache memory is small amount of RAM located on the CPU itself. It stores commonly used data that is being constantly used by the operating system, allowing for even faster access than the RAM.
ROM / PROM
Programmable ROM (PROM) / Flash Memory
Flash memory is a form of ROM that is commonly used in embedded devices such as washing machines or smart tvs.
Flash memory is:
- Very reliable
- Relatively Secure( because it requires the memory to be flashed, files can’t just be copied / edited in place)