Caches (PPT 2 - 4) Flashcards
What are the four goals we wish to achieve?
- Fast processing
- Fast Memory
- Large Memory
- Cheap
What is the Von Neumann Bottleneck?
It takes a much longer time to read data from memory than it does to actually process it
What is a cache?
A small storage area located close to a processing unit, which stores recently used data taken from a larger, but more distant and slower, storage area.
What is the payload of a cache?
The payload is the data and instructions fetched from memory
What are the four traits of a computer cache?
- Physically very close to the processor for fast access
- Is very small
- Is accessed instead of main memory when doing a “main memory access”
- Functions automatically without software control
What is locality of reference?
- When an item is used, it will probably be used again
- When an item is used, the items around it will likely be used
How does a cache work?
It uses locality of reference, meaning it keeps a local copy of the original data and possibly the material around it to avoid going back to the original source
Examples of Locality of Reference in Computing?
-ZIP Compression exploits repeated sequences in text
-Using the same applications regularly
Program loops use the same code repeatedly
How small is the cache compared to main memory usually?
It is usually about 1% of main memory
Why does a cache work?
A cache works because if the same data is needed again, it only takes 1 clock cycle to access rather than the full 8 it would take to fetch it from main memory
How does the CPU use a cache?
When the CPU needs to fetch, it first checks the cache to see if the data is there. If it is, it gets a cache “hit”. If it isn’t, it gets a cache “miss” and has to read the data from main memory
Is the processor aware a cache exists?
No, it treats the cache in the same way it treats main memory, meaning memory addressing is the same
Name another type of caching
Disk Caching, from memory to hard disk
What are the four possible issues with using a cache?
- Usage: Must function automatically
- Mapping: Cache is small so must be able to map main memory to it
- Coherence: Cache contains a copy of memory locations and integrity must be maintained during use
- Updating: Cache is normally full so needs to be able to handle new data
What is Cache Overhead?
The cache needs additional space for housekeeping information and decoding information. This means storage is always more than the payload size but the quoted size is always the payload size only
What are the three main cache mapping methods?
- Direct mapping
- Fully associative mapping
- N-way set associative mapping