Types of memory
Memory stores data and instructions. It is divided into primary (main) memory, which the CPU uses directly, and secondary (auxiliary) memory for permanent storage.
Primary memory
RAM – Random Access Memory
- Read–write memory that holds programs and data currently in use.
- Volatile – contents are lost when power is switched off.
- "Random access" means any location can be reached directly in the same time.
- SRAM (Static RAM) – made of flip-flops; fast, costly, no refreshing needed; used for cache.
- DRAM (Dynamic RAM) – stores bits in capacitors that must be refreshed thousands of times a second; cheaper, used as main memory. Modern forms: SDRAM, DDR4, DDR5.
- Desktop RAM modules are DIMMs; laptop modules are smaller SO-DIMMs.
ROM – Read Only Memory
- Non-volatile – keeps data without power. Holds firmware such as the BIOS.
- PROM – Programmable ROM; can be written only once.
- EPROM – Erasable PROM; erased with ultraviolet (UV) light.
- EEPROM – Electrically Erasable PROM; erased with electricity. Flash memory is a fast type of EEPROM (pen drives, SSDs, memory cards).
Cache memory
Very fast SRAM between CPU and RAM that keeps frequently used data. Levels L1, L2, L3.
Secondary memory
Non-volatile, large capacity, cheaper per byte, slower than RAM. Not accessed directly by the CPU — data is first loaded into RAM.
Magnetic storage
- Hard Disk Drive (HDD) – spinning platters coated with magnetic material, read by a read/write head. Each surface has circular tracks divided into sectors; the same track on all platters forms a cylinder. Speed in RPM (5400, 7200). Access time = seek time + rotational latency. The first hard disk was IBM's 350 RAMAC (1956).
- Magnetic tape – sequential access; cheap, very large; used for backup and archives.
- Floppy disk – old removable disk; the 3.5-inch floppy held 1.44 MB.
Optical storage (read by laser)
| Disc | Typical capacity | Notes |
|---|---|---|
| CD (Compact Disc) | 700 MB | CD-ROM read-only; CD-R write once; CD-RW rewritable |
| DVD (Digital Versatile Disc) | 4.7 GB single layer; 8.5 GB dual layer | Movies, software |
| Blu-ray Disc | 25 GB single layer; 50 GB dual layer | Uses a blue-violet laser with shorter wavelength |
Solid-state storage (flash, no moving parts)
- SSD (Solid State Drive) – much faster, quieter and more shock-resistant than an HDD; uses NAND flash. NVMe SSDs connect over PCIe for very high speed.
- Pen drive / USB flash drive, memory cards (SD, microSD).
Cloud storage keeps files on internet servers (Google Drive, OneDrive, DigiLocker).
Memory units
| Unit | Equal to |
|---|---|
| Bit | 0 or 1 – smallest unit |
| Nibble | 4 bits |
| Byte | 8 bits (one character) |
| Kilobyte (KB) | 1024 bytes |
| Megabyte (MB) | 1024 KB |
| Gigabyte (GB) | 1024 MB |
| Terabyte (TB) | 1024 GB |
| Petabyte (PB) → Exabyte (EB) → Zettabyte (ZB) → Yottabyte (YB) | each 1024 times the previous |
Order to remember: Bit < Nibble < Byte < KB < MB < GB < TB < PB < EB < ZB < YB. (Storage makers often use 1000 instead of 1024, so a "1 TB" disk shows a little less in Windows.)
Memory hierarchy
Registers → Cache → RAM → SSD → HDD → Optical/Tape. Going down: speed falls, capacity rises, cost per bit falls.
Virtual memory and other terms
- Virtual memory – the OS uses part of the disk as if it were RAM (page file/swap). Data moves in fixed blocks called pages (paging). Too much swapping is called thrashing.
- Buffer – temporary storage that smooths data transfer between devices of different speeds (e.g. printer buffer).
- Formatting prepares a disk (tracks, sectors, file system). Defragmentation rearranges scattered file pieces on an HDD so they are read faster.
- Random access – reach any location directly (RAM, disks). Sequential access – read in order from the start (tape).
Quick recall: RAM volatile, ROM non-volatile · SRAM → cache, DRAM → main memory · EPROM erased by UV · Tape = sequential · CD 700 MB, DVD 4.7 GB, Blu-ray 25 GB · 1 byte = 8 bits, 1 KB = 1024 bytes.