Memory Types (RAM/ROM/Storage)
Comprehensive guide to computer memory and storage. Master the memory hierarchy, Cache levels, volatile vs non-volatile memory, SRAM vs DRAM, EPROM/EEPROM, magnetic/optical/SSD storage, virtual memory, and measurement units.
1. Memory Hierarchy & Cache Performance
Computer systems implement a memory hierarchy to balance access speed, storage capacity, and hardware cost.
A. The Memory Hierarchy Pyramid
As you move down the hierarchy:
- Access Speed decreases (Registers are fastest, HDDs/magnetic tapes are slowest).
- Storage Capacity increases (Registers hold bytes, HDDs hold Terabytes).
- Cost per bit decreases (Registers are very expensive, secondary storage is extremely cheap).
B. Cache Memory & Locality of Reference
Cache memory is situated between the CPU and main RAM. It relies on the principle of Locality of Reference:
- Temporal Locality: If a memory location is accessed once, it is highly likely to be accessed again in the near future (e.g., loop variables).
- Spatial Locality: If a memory location is accessed, nearby locations are likely to be accessed soon (e.g., array traversal).
Cache Levels: L1 Cache is built inside each CPU core (smallest, fastest). L2 Cache is slightly larger and placed close to the core. L3 Cache is shared among all CPU cores on the chip (largest, slowest cache level).
2. Primary Memory: SRAM, DRAM, and ROM variations
Primary memory is directly addressable by the CPU using the system bus. It is divided into volatile RAM and non-volatile ROM.
A. RAM (Random Access Memory) - Volatile
| Feature Parameter |
SRAM (Static RAM) |
DRAM (Dynamic RAM) |
| Basic Cell Element |
Flip-flops (uses 4-6 transistors). |
A single transistor and a capacitor. |
| Electrical Refreshing |
Not required. Retains charge as long as power is active. |
Required periodically because capacitors leak charge. |
| Speed & Access Time |
Extremely fast (1-10 ns). |
Slower (30-80 ns). |
| Cost & Density |
Highly expensive, lower storage density. |
Cheap, high storage density (ideal for main memory). |
| Primary Application |
CPU Cache memory (L1, L2, L3). |
System Main Memory (System RAM). |
B. ROM (Read Only Memory) - Non-Volatile
- PROM (Programmable ROM): Manufactured blank. The user can program it once using a PROM programmer. It cannot be erased thereafter.
- EPROM (Erasable PROM): Can be erased by exposing the chip to Ultraviolet (UV) light for about 20-30 minutes through a quartz window.
- EEPROM (Electrically Erasable PROM): Can be erased and rewritten electrically, byte-by-byte.
- Flash Memory: A specialized block-erasable derivative of EEPROM. Used in SSDs, memory cards, and USB flash drives because it is faster than byte-erasable EEPROM.
3. Secondary Storage & Measurement Standards
Secondary storage is non-volatile, high-capacity, and is used to store programs and data permanently.
A. Storage Media Technologies
- Magnetic Storage: Uses magnetic fields. Hard Disk Drives (HDDs) contain rotating platters, tracks, sectors, and read/write heads. Magnetic Tape is sequential-access, used for archival backups.
- Optical Storage: Uses lasers to read pits (dark spots) and lands (reflective flat spots):
- CD (Compact Disc): Standard capacity is 700 MB.
- DVD (Digital Versatile Disc): Single-layer capacity is 4.7 GB; dual-layer is 8.5 GB.
- Blu-ray Disc: Single-layer capacity is 25 GB; dual-layer is 50 GB. Uses a blue-violet laser (shorter wavelength than red laser, allowing tighter data packing).
- Solid-State Storage: Uses NAND flash memory with no moving parts. Solid State Drives (SSDs) are faster, silent, and shock-resistant compared to traditional HDDs.
B. Memory Measurement Units
The standard binary conversions used in digital storage:
- 1 Bit: Binary digit (0 or 1).
- 1 Nibble: 4 Bits.
- 1 Byte: 8 Bits (smallest addressable unit).
- 1 Kilobyte (KB): 1024 Bytes (210 Bytes).
- 1 Megabyte (MB): 1024 KB (220 Bytes).
- 1 Gigabyte (GB): 1024 MB (230 Bytes).
- 1 Terabyte (TB): 1024 GB (240 Bytes).
- 1 Petabyte (PB): 1024 TB (250 Bytes).
- 1 Exabyte (EB): 1024 PB (260 Bytes).
Evolution of Computer Memory Technologies
- 1932 — Magnetic Drum Memory: Invented by Gustav Tauschek in Austria. It was widely used in the 1950s as the primary computer memory before magnetic cores.
- 1951 — Magnetic-Core Memory: Developed by An Wang and Jay Forrester. It became the dominant form of non-volatile main memory until semiconductor RAM arrived in the 1970s.
- 1966 — DRAM (Dynamic RAM): Invented by <strong style="color: #e67e22; font-weight: 700;">Dr. Robert Dennard</strong> at IBM. Used a single transistor and capacitor design to store each bit, allowing high density at low cost.
- 1980s — EEPROM & Flash Memory: Invented by <strong style="color: #e67e22; font-weight: 700;">Fujio Masuoka</strong> at Toshiba. Enabled electrical erasure in blocks, paving the way for SSDs, USB drives, and SD cards.
- 2011 — Modern NVMe Solid State Drives: Introduction of the <strong style="color: #e67e22; font-weight: 700;">NVMe protocol</strong> designed specifically for flash storage over PCIe buses, bypassing slow SATA interfaces.
Key Questions & Answers
- What is Cache Memory, and why is it used?
- Cache is a extremely fast, small memory buffer made of SRAM located close to the CPU. It stores frequently accessed instructions/data to reduce CPU wait time (utilizing locality of reference ).
- What type of ROM can be erased electrically byte-by-byte, and is commonly used for BIOS chips?
- EEPROM (Electrically Erasable Programmable Read-Only Memory) . Unlike EPROM which requires ultraviolet light, EEPROM can be erased and rewritten electrically.
- What is Virtual Memory?
- A memory management technique where the OS uses a portion of the secondary storage (like a HDD/SSD swap file) to simulate additional physical RAM when physical memory runs low.
- Arrange the following units in ascending order: Terabyte, Petabyte, Gigabyte, Exabyte.
- Gigabyte (GB) . Each step is 1024 times larger than the previous one (2 10 ).
Memory Aids
- Mnemonic 1: Memory Hierarchy (Speed vs Capacity): From fastest/smallest/most expensive to slowest/largest/cheapest: • R — R egisters (inside CPU) • C — C ache (SRAM near CPU) • P — P rimary Memory (DRAM/RAM) • S — S econdary Storage (SSD/HDD)
- Mnemonic 2: Volatility Rule: Volatility recall: • RAM is Volatile : Data vanishes when power is lost. • ROM is Non-Volatile : Data remains permanent (BIOS/Firmware).
- Mnemonic 3: DRAM vs SRAM Components: Tech difference: • DRAM uses C apacitors that leak charge, requiring constant R efreshing. • SRAM uses F lip-flops (transistors), which do N ot need refreshing.
Common Exam Traps
- Trap 1: Assuming SRAM is slower than DRAM. Actually, SRAM (Static RAM) is much faster than DRAM (Dynamic RAM) and is used for Cache. DRAM is slower because it needs continuous electrical refresh cycles, but it is much cheaper and denser, making it suitable for main RAM.
- Trap 2: Confusing the erasure method of EPROM and EEPROM. EPROM is erased using Ultraviolet (UV) light (requires exposing the chip through a quartz window). EEPROM is erased electrically using high-voltage pulses, without removing the chip.
- Trap 3: Believing Virtual Memory increases the physical speed of execution. Virtual memory actually slows down processing (due to disk swapping/thrashing) but allows running larger programs that otherwise wouldn't fit in physical RAM.
- Trap 4: Misunderstanding memory capacity values. In binary computer units, 1 Kilobyte is 1024 Bytes (2 10 ) , not exactly 1000 Bytes (10 3 ). Keep this in mind during mathematical conversions.