9. Exercises

See the book for exercises using paging-policy.py
$ python ./paging-policy.py -m 6 -c -s 10

Access: 3  MISS FirstIn ->          [3] <- Lastin  Replaced:- [Hits:0 Misses:1]
Access: 2  MISS FirstIn ->       [3, 2] <- Lastin  Replaced:- [Hits:0 Misses:2]
Access: 3  HIT  FirstIn ->       [3, 2] <- Lastin  Replaced:- [Hits:1 Misses:2]
Access: 1  MISS FirstIn ->    [3, 2, 1] <- Lastin  Replaced:- [Hits:1 Misses:3]
Access: 4  MISS FirstIn ->    [2, 1, 4] <- Lastin  Replaced:3 [Hits:1 Misses:4]
Access: 4  HIT  FirstIn ->    [2, 1, 4] <- Lastin  Replaced:- [Hits:2 Misses:4]
Access: 3  MISS FirstIn ->    [1, 4, 3] <- Lastin  Replaced:2 [Hits:2 Misses:5]
Access: 0  MISS FirstIn ->    [4, 3, 0] <- Lastin  Replaced:1 [Hits:2 Misses:6]
Access: 3  HIT  FirstIn ->    [4, 3, 0] <- Lastin  Replaced:- [Hits:3 Misses:6]
Access: 1  MISS FirstIn ->    [3, 0, 1] <- Lastin  Replaced:4 [Hits:3 Misses:7]

FINALSTATS hits 3   misses 7   hitrate 30.00
Compare with LRU.