ScholaFly

CS05-02 Computer Science Watch

Cache

Watch on YouTube

In this lesson

In this video you'll learn about cache for GCSE Computer Science. Watch first: {{video:CS05-01}}

By the end: Explain that cache is a small amount of very fast memory, inside or very close to the CPU, that holds the data and instructions the CPU is using or is likely to use next so it does not have to wait for RAM; and give two-part reasons why a computer has much more RAM than cache.

What it covers

  • WHAT CACHE IS: a small amount of very fast memory, on or very close to the CPU
  • WHAT IT HOLDS: data and instructions - the words, not 'information' - that the CPU is using frequently or is likely to need next
  • WHY IT EXISTS: fetching from RAM is slow compared with the CPU; if what the CPU needs is already in cache, it does not have to wait for RAM
  • WHY THERE IS MUCH LESS CACHE THAN RAM: cache is far more expensive per byte, and it has to physically sit near the CPU where there is little room. Each reason must be a COMPLETE two-part reason - 'cache is more expensive, so a large amount would make the computer too expensive' - not half of one
  • Where cache sits in the family from CS05-01: faster and smaller than RAM, slower and larger than registers - named as an order, not as a technical hierarchy diagram with levels
  • That cache is volatile, like RAM
  • That THIS cache is the CPU's memory cache, NOT the web browser cache or a disk cache - same word, different thing

Key words

About this video

Cache Memory (CPU Cache): Speed and Size | GCSE Computer Science

How cache memory works in a CPU, why it is faster than RAM, and why a computer has far more RAM than cache.
AQA 8525 and OCR J277 GCSE. Memory and storage 2 of 6.
Full Memory and storage playlist: https://www.youtube.com/playlist?list=PLN6LILUAa4Zs
More at https://scholafly.com

Watch first: RAM, ROM and types of memory - https://youtu.be/uyM_YCx5vAU
Video code: CS05-02 (search "ScholaFly CS05-02")

Videos in this chapter:
CS05-00 Memory and storage - Intro: https://youtu.be/HP7hdjSfVjI
CS05-01 RAM, ROM and types of memory: https://youtu.be/uyM_YCx5vAU
CS05-02 Cache: https://youtu.be/GZUhJCGdqMY
CS05-03 Virtual memory: https://youtu.be/BUkacndz4Nc
CS05-04 Secondary storage: magnetic, solid state and optical: https://youtu.be/5Amsjf0nS8E
CS05-05 Choosing the right storage: https://youtu.be/79gK1sMFliI
CS05-06 Cloud storage: https://youtu.be/8bnzEUvDMfQ

#GCSEComputerScience #MemoryAndStorage #Cache

For teachers
This GCSE Computer Science lesson teaches cache. By the end, students should be able to explain that cache is a small amount of very fast memory, inside or very close to the CPU, that holds the data and instructions the CPU is using or is likely to use next so it does not have to wait for RAM; and give two-part reasons why a computer has much more RAM than cache. It works through four worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.

Exam board specification references:
AQA GCSE Computer Science (8525)
- 3.4.5 Systems architecture
Cambridge OCR Level 1/Level 2 GCSE (9-1) in Computer Science
- 1.2.1 Primary storage (memory)

Read the transcript

Cooking from a recipe gets slow when every ingredient lives in a shop down the road. You could walk to the shop for every single egg. Or you could keep tonight's few ingredients on the counter right beside you. The counter is tiny, and space in a kitchen costs money, but it saves a walk every time you reach for something. Your processor has a counter like that. The puzzle is why it does not turn the entire kitchen into counter.

This is video two of six in Memory and storage. If RAM itself still feels unsteady, the video called RAM, ROM and types of memory sets it up.

In real words, the shop down the road is RAM, and the counter is cache. Cache is a small amount of very fast memory, inside the processor or right beside it. It holds the data and instructions the processor is using often, or is likely to need next. Data and instructions are the words for what it holds, every time. Fetching from RAM is slow compared with the speed of the processor. If what the processor needs is already in cache, it does not have to wait for RAM. In the video on what makes a CPU perform well, more cache meant a faster processor. This is the reason behind that. Picture a loop that needs the same instruction ten times in a row, on a computer with cache. Of those ten trips to fetch the instruction, which ones go all the way to RAM? Only the first. That trip goes to RAM, a copy lands in cache, and the next nine come from cache. Without cache, all ten trips go to RAM, and the processor waits every time. Those nine saved waits are what cache is for. RAM is still needed, though. The first trip went there, and RAM still holds everything currently running, while cache holds a small selection of it. Cache is volatile, like RAM. It is a fast working copy, and it starts empty each time the computer is switched on. Now, from fastest to slowest, how do registers, cache, RAM and secondary storage line up? Registers are fastest, then cache, then RAM, with secondary storage slowest of all. Now, from smallest to largest, how do registers, cache, RAM and secondary storage line up? The same order again. Registers hold the least, then cache, then RAM, and secondary storage holds the most. Put the two orders side by side and the pattern shows. The faster a kind of memory is, the less of it a computer has.

That pattern is the kitchen puzzle in real words, because a computer has far more RAM than cache. Why does a computer have much more RAM than cache, if cache is faster? Two reasons. Cache costs far more per byte than RAM, and it has to sit right beside the processor, where there is very little room. Two students write the first reason down. A writes: cache is more expensive than RAM. B writes: cache is more expensive than RAM, so fitting a large amount would make the computer cost too much. Which of the two, A or B, gives a complete reason? B. A stops halfway, while B carries on with a so, and says what follows for the size you can fit. A full reason has two parts: something true about cache, and then what that means for how much of it a computer can have. The word so joins them. The second reason, completed: cache has to sit right beside the processor, so there is only room for a small amount of it. One examiner's report on this question puts it like this: Many students answered that RAM is cheaper than cache but often only gave half of the response required for the second mark, for example ‘RAM can store more data’ or ‘cache only stores frequently used instructions’. The fix is to finish every reason. Check that it carries a so, followed by what the fact means for the amount of cache.

A second thing shares the name. Your web browser keeps a cache too, a store of copies of websites you have visited, so they load faster next time. That is a different thing with the same word. In this topic, cache always means the processor's memory cache, and neither the browser cache nor a disk cache is it. A student writes: cache stores information that the computer uses a lot, like websites you visit often, so they load faster. What are the two mistakes in that student's sentence about cache? First, the vague noun: cache holds data and instructions. Second, the example describes the browser's own store, a different thing. Rewritten, it reads: cache holds the data and instructions the processor uses often or needs next, so it does not have to wait for RAM. One examiner's report names the browser slip in a single line: Cache memory was often confused with web browser cache. The way to avoid it is to picture the processor, not the browser, whenever the word cache appears in a question. RAM and cache get muddled with each other too, so keep three things apart. Cache sits on or beside the processor, while RAM sits on the motherboard, further away. Cache is faster, and RAM is far bigger. A different examiner's report records that muddle between RAM and cache: A few students confused RAM and CACHE memory. Instead of describing either one alone, compare them on where they sit, how fast they are and how big they are, and the two stay apart.

The kitchen counter comes back for four questions, one at a time. A phone runs the same photo filter on every pixel of a picture. Why does cache help? The filter's instructions are used again and again, so after the first trip to RAM they come from cache, and the processor stops waiting. Next, what is one complete reason a computer has more RAM than cache? Cache is very expensive, so a lot of it would make the computer cost too much. Or: it must sit beside the processor, so there is only room for a little. Now, what does cache hold: information, or something more exact? Data and instructions, the ones the processor uses often or is likely to need next. Another one: what is in cache the moment the computer is switched on? Nothing yet. Cache is volatile, so it starts empty and fills up as the processor works.

If you are solid on the two complete reasons for keeping cache small, press the thumb under this one. It marks the video as done for you, and only you. If the so keeps slipping out of your reasons, keep the video saved instead. Writing complete reasons comes with practice, and the next videos give you plenty.

Next in the chapter: Virtual memory, what a computer does when its RAM is full.

For more, visit scholafly.com, or watch the next video.

Related terms

For: AQA GCSE 8525, OCR GCSE J277

On the specification

BoardSpecStatement
AQA GCSE 85253.4.5Systems architecture
OCR GCSE J2771.2.1Primary storage (memory)
For teachers

This GCSE Computer Science lesson teaches cache. By the end, students should be able to explain that cache is a small amount of very fast memory, inside or very close to the CPU, that holds the data and instructions the CPU is using or is likely to use next so it does not have to wait for RAM; and give two-part reasons why a computer has much more RAM than cache. It works through four worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.