TLB Simulator
TLB Simulator (LRU)
Simulate a TLB with LRU replacement.
Function
func TLBHits(capacity int, pages []int) (hits int, misses int)
Rules
- Capacity is the maximum number of cached pages.
- On access:
- If the page is in the cache, it is a hit and becomes most recently used.
- Otherwise, it is a miss. If the cache is full, evict the least recently used page.
Notes
- If
capacity <= 0, all accesses are misses.
Run tests to see results
No issues detected