Search

Memory

Memory is used to store data/information and instructions. It is a data stroage unit or a data stroage device where data is to be processed and instructions required for processing are stored.
💡
Problem
Memory gets incredibly expensive as it gets faster
Solution
1.
The hierarchy of memories:
a.
Fastest, smallest and most expensive memory per bit at the top
b.
Slowest, largest, cheapest memory at the bottom

Primary Memory

Secondary Memory

•
Fixed Storage
◦
Hard Disk Drives (HDD)
◦
Solid-State Disk (SSD)
◦
Internal Flash Memory
◦
etc.
•
Removable Storage
◦
Optical Disks
▪
DVDs
▪
CDs
▪
Blu-ray Discs
◦
Memory Cards
◦
etc.

Cache Memory

Locality of Reference

Temporal Locality

•
Programs tend to reference the same memory location at a future point in time
◦
Loops
◦
Iteration
◦
etc.

Spatial Locality

•
Programs tend to reference memory locations that are near other recently-referenced memory loc
◦
Contiguous Data Structure
◦
Array
◦
etc.

Sequential Locality

•
Programs tend to be accessed sequentially

Reference