Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that immediately following the two read operations of question 2, the pr

ID: 3702404 • Letter: S

Question

Suppose that immediately following the two read operations of question 2, the program does read operations on the following memory addresses (e.g., with “lb” or “lw” instructions): 520, 320, 668, 344, 520 (again), and 1020. Assuming the cache was empty prior to the read operations of question 2, state which of these read operations will result in cache hits, assuming a 2-way set-associative cache with a total capacity of 4 eight-word blocks and LRU replacement in each set.

Question 2: Suppose that a program does read operations on the following memory addresses (e.g., with “lb” or “lw” instructions): 332, 996. Give the number of the memory block that each of these addresses belongs to, for each of the following memory block sizes. (a) block size of one word (4 bytes) (b) block size of eight words (32 bytes)

Explanation / Answer

Solution:

So the cache memory will look like this in which the replacements will be done.

set 0 and set 1 contains two blocks each

Now, at the very beginning after question 2 is done 332 and 996 was in the cache

Now comes 520, cache miss

320, miss

668, miss

332 will be replaced since it was least recently used

344, miss, 996 will be replaced with 344

520, cache hit.

1020, miss, 320 will be replaced.

Only one hit which is 520.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote