I am just getting into Java and have been given a test from my fellow colleagues.
They have asked me:
"Given test data in a sequence of random numbers in the range 00000 - 99999.
Each of these numbers is an address reference. So, every A is a p-digit number, p = 5.
Cache Size = 100 Bytes (N = 2)
Block Size = 10 Bytes (M = 1)
Build a Java program for a Direct Mapped and Fully Associative Cache.
Show the contents of the Cache after all the given references have been made (in both cases) in the order they were supplied.
Calculate hit and miss rates (in both cases).
For displaying the cache contents, represent the memory content at address A simply as M(A).
Where necessary, you should employ the Least Recently Used scheme for block replacement."
(Test data is 119 random numbers all of 5 digits).