assignment 4 part 1 get_block_size()

157 views
Skip to first unread message

M W

unread,
Nov 1, 2020, 1:44:12 AM11/1/20
to cmpt-295-sfu
I dont understand what flush_cache() is supposed to do. I thought when it is called it will empty out the cache but when I tried this:

  flush_cache();

  for (addr_t i = 0; i < 0xffffffffffffffff; i++)
    if (access_cache(i)){
      printf("%llu\n", i);
      i += block_size;
    }

It prints out many numbers so meaning the cache is not empty?

Arrvindh Shriraman

unread,
Nov 1, 2020, 4:06:51 PM11/1/20
to cmpt-295-sfu
flush cache will flush the cache.
If you are seeing many prints that means access_cache is hitting. 

- Remember that access cache is not only saying if its a hit for the current access, it is also loading things into the cache that is going to affect your future accesses. Hence its causing things to hit. 

- However your code is trying to issue addresses that you think should be missing. But they are not. Think why that might happen.


FYI; do not post actual code  on the groups. please provide link to repo.

M W

unread,
Nov 1, 2020, 6:27:42 PM11/1/20
to cmpt-295-sfu
Sorry I will remember that for next time. Thanks for the explanation.
Reply all
Reply to author
Forward
0 new messages