Learning Rooms/○ Level 3 · Innovator/Computing and algorithms
Memory & Storage: Crash Course Computer Science #19
CrashCourse · Length: see YouTube · captions on YouTube · nothing loads until you press play
By the end you can…
- Order registers, caches, main memory and storage by latency, capacity and cost per byte.
- Explain temporal and spatial locality with code examples.
- Predict qualitatively whether an access pattern will hit or miss in a cache.
Watch it all: no segment has been checked by hand for this video yet.
1.Predict before you press play
A cache with 16-byte blocks reads 32 consecutive 4-byte integers, starting empty. How many misses?
Pick one before you press play. A wrong guess is fine: it is what makes the video stick.
2.See the idea first
Play with this diagram for a minute. It gives you something to hang the video on.
Loading the interactive…
Can't use the diagram? Read a description instead
The cache simulator lists each address, its set and tag, and whether it hits. With 16-byte blocks: walking 32 integers gives 8 misses and 24 hits; reading 16 integers twice gives 4 misses; a 64-byte stride misses every time.
3.Watch, actively
A history of memory technologies that makes the speed-versus-capacity trade-off of the hierarchy concrete.
Length: see YouTube · captions on YouTube · source
Nothing loads from YouTube until you press play.
Watch for…
- → Notice how each memory technology trades speed for capacity: that trade is why a hierarchy exists.
Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.
Can't stream it? Read the idea instead
Memory that is fast is small and expensive; memory that is large is slower and cheaper. Computers stack them in a hierarchy, from registers and caches to main memory and storage, and keep recently used data near the top because programs tend to reuse it.
What the video covers (our own note, written when we verified it): A history of memory technologies that makes the speed-versus-capacity trade-off of the hierarchy concrete.
Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.
Read it instead
- Lesson: Locality and the memory hierarchy · The full lesson explains the idea in text, worked examples and diagrams, with no video needed.
- Engineering Atlas: Memory hierarchy and caches · Rearranging a loop so it walks memory in order can make the same program on the same chip several times faster.
- Field Guide: Address space · A short reference entry on the same idea.
- Systems Atlas: Computer · A real system that uses this idea, explained without video.
Jot down one thing that surprised you and one question you still have.
4.Practise what you just saw
These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.
Practice 1
A loop reads 256 consecutive 4-byte floats into an empty cache with 64-byte blocks. How many misses?
Practice 2 · a fresh version every time
A direct-mapped cache has 4 lines of 16 bytes and starts empty. The CPU reads these byte addresses in order: 124, 272, 272, 368, 20, 20, 272, 144, 144, 144. How many reads hit?
Practice 3
Reading every 64th byte with 16-byte blocks gives 100% misses. What happens if blocks grow to 32 bytes?
Practice 4
Which list is ordered from fastest to slowest?
5.Try it yourself
No simulation models this idea yet. The lesson below has an interactive diagram instead.
6.Where engineers use it
Image-processing code tiles an image into small squares that fit in the cache, processing each completely before moving on. The arithmetic is identical; the speed is not.
From the applied view in the lesson Locality and the memory hierarchy. Checked by automated tests only.
7.Build something with it
Follow-up project
Write two versions of a 2-D image blur in the Code Lab: row-major and column-major traversal. Without timing them, predict which is faster and by roughly how much using a 64-byte block. Then explain how you would test your prediction fairly.
Where this video lives
- Locality and the memory hierarchy · Level 5, week 21
In the course catalogue: ARCH-510 Microarchitecture, memory and chips
The video is by CrashCourse, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.