All problems
TLB Entry Eviction Pick
Problem
Pick the least recently used TLB entry for eviction.
entries is a list of [page, last_used_tick] pairs. Choose the entry with the smallest last-used tick, breaking ties by the smallest page number.
Return the page to evict, or None when the TLB is empty.
Hint
Ties in recency are broken deterministically by the page number.
Test cases
case 1
in: [[[1,5],[2,3],[3,3]]]
expected: 2
case 2
in: [[[9,0]]]
expected: 9
case 3
in: [[]]
expected: null
case 4
in: [[[4,7],[2,7],[3,1]]]
expected: 3
Starter codePython
def tlb_evict_pick(entries):
# Your code here
pass4 test cases · run your code against them in the editor