Memory Hierarchy Flashcards
Draw a diagram of a machine’s memory hierarchy
.
Where is SRAM found? What are its characteristics?
On processor chip
Low latency, high bandwidth, size limited by chip area, read/write size can easily be byte level
Where is DRAM found? What are its characteristics?
Off chip
Higher latency
High bandwidth
Reads/writes are in small blocks, transferred as burts
What type of hardware does page-based virtual memory use? What are its characteristics?
Magnetic hard disk or SSD
High latency, lower bandwidth, reads/writes in larger blocks needed for extensive error detection and correction codes
Describe static multiple issue
- Compiler groups instructions to be executed together into “issue slots”
- Compiler detects and avoids hazards
Describe dynamic multiple issue
- CPU chooses instructions to issue each cycle
- Compiler can help reorder instructions
- CPU resolves hazards at runtime
What is speculation?
Guess what to do with an instruction, start operation asap, check whether guess was right and either complete the sequence or roll-back and do the right thing
Give an example of speculation
Speculate on branch outcome - roll back if different path is taken
What makes pipelining harder?
Poor ISA design:
1. Complex instruction sets
2. Complex addressing modes
3. Delayed branches
What is the principle of locality?
Programs access a small proportion of their address space at any time, giving rise to spatial and temporal locality
What is temporal locality?
Items accessed recently are likely to be accessed again soon
Give 2 examples of temporal locality
- Instructions in a loop
- Loop counters
What is spatial locality?
Items near those accessed recently are likely to be accessed soon
Give 2 examples of spatial locality
- Sequential instruction access
- Array data
What is cache?
Memory that holds recently used data so that it can be accessed with a lower latency next time to alleviate the von Neumann bottleneck
What is a cache hit? What happens?
Data is found in the cache, so read
What is a cache miss? What happens?
Data not in cache, so fetch from next level in memory hierarchy
Write the equation for miss rate
Miss rate = number of cache misses / number of memory accesses
Draw a diagram of a crude direct-mapped cache
.
In a crude direct-mapped cache, for a given address, how many places are there to look?
1
Give a real life example of a direct-mapped cache
Order all books by first two letters
Go to the right place and read the tag of the relevant book to check it is the correct one - there can only be one entry for each tag
Which property must each item in a crude direct-mapped cache have?
A unique hash function value ie. cache address/tag
What does the hash function do in a crude direct-mapped cache?
Takes the load address and converts it to the cache address, where the data is stored
Give a disadvantage of a crude direct-mapped cache
Storing the address as a tag for every data item is a big overhead