total elements in matrix = 216 * 216.= 232
as page size is 210 and size of each element is 8 bytes,so we can store only 2^7 elemnts in one frame.
aftr a miss,elements will be loaded in row major order like A[0,0] A[0,1 ,A[0,2]..A[0,127].
but here elements are accessed in column major order i.e A[0,0] then A[1,0] -> A[2,0] ....A[216,0].
sor,for each element accessed,there will be a miss.
now,when A[0,0] will be accessed then there will be a miss and A[0,0] to A[0,127] will be brought to first frame. // MISS 1
when A[1,0] will be accessed then another miss and A[1,0] to A[1,127] will be loaded to second frame.//MISS 2
similarly we will have 8 misses till 8th frame is filled.and in 8th frame,A[7,0] TO A[7,127] will be there.
now next is A[8,0].as all frames are full,we need to replace and LRU is used.so,8th frame will be replaced and A[8,0 to A[8,127] will be loaded.
similarly,for all the accesses till A[216-1,0],the 8th frame will be replaced.so ,for first iteration,we will get 216 misses.the content of 8th frame will be A[65535,0] to A[65535,127].
for next iteration,A[0,1] will be accessed first but there will be no miss for that as it was already loaded in first frame when A[0,0] was loaded.
similarly for A[1,1] A[2,1] A[3,1] A[4,1] A[5,1] A[6,1]..no miss will occur.but for A[7,1],miss will occur and it will replace 7th frame as it is least recently used.so,wee will load A[7,1 ] to A[7,128].similarly,for all the consecutive accesses for elements A[8,1] to A[65534,1],we will get a miss.,for A[65535,1],no miss will occur as it is already loaded in 8th frame in first iteration.and hence total misses in second iteration will be 216 -8
so,now content of 7th frame will be a[65534,1] to A[65534,128].
in next iteration,from A [0,2] to A[5,2] ,no miss occurs
for A[65534,2] and A[65535,2] also,no miss occurs as they are already loaded.in last iteration.
but all the elements from A[6,2] to A[65533,2] will be loaded in 6th frame as it is least recently used
hence total misses are 216 - 8 misses.
going on,i guess we will get 216 + 65534 * ( 216 -8) misses.
i know i am wrong somewhere,so pls point out my mistake and help. :)