Cache memory exists to make computers faster, but simply knowing what cache is is not enough for IB Computer Science. Students are expected to understand how cache is used, and especially the ideas of cache hits and cache misses.
These concepts explain why cache improves performance and are often tested in system performance and CPU efficiency questions. Clear explanations using correct terminology are essential for full marks.
Why Cache Is Needed in the First Place
Modern CPUs operate far faster than RAM. Without cache memory:
- The CPU would frequently wait for data
- Processing speed would be limited by memory access times
Cache acts as a high-speed buffer between the CPU and RAM, storing data and instructions that are likely to be needed next.
What Is a Cache Hit?
A cache hit occurs when the CPU looks for data and finds it in the cache.
This means:
- The data is immediately available
- No access to RAM is required
- The CPU can continue processing without delay
Cache hits are desirable because cache memory is extremely fast compared to main memory.
In IB answers, students should explain that a cache hit:
- Reduces latency
- Improves overall system performance
- Allows the CPU to operate efficiently
What Is a Cache Miss?
A cache miss occurs when the CPU looks for data and does not find it in the cache.
When this happens:
- The CPU must request the data from RAM
- The data is transferred from RAM to the cache
- The CPU then accesses the data from cache
This process takes significantly longer than a cache hit.
IB examiners expect students to recognise that:
- Cache misses slow down execution
- Cache misses are unavoidable but should be minimised
Types of Cache Misses (HL Awareness)
At a higher level, students may be aware that cache misses occur for different reasons, such as:
- Data not yet loaded into cache
- Cache being too small
- Previously cached data being replaced
However, IB students are not expected to memorise advanced classifications — understanding the general concept is sufficient.
