# GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 65

Consider a 4-way set associative cache (initially empty) with total 16 cache blocks. The main memory consists of 256 blocks and the request for memory blocks is in the following order:

0, 255, 1, 4, 3, 8, 133, 159, 216, 129, 63, 8, 48, 32, 73, 92, 155.

Find the total number of hit(s) occurred in the cache using least recently used (LRU) page replacement algorithm ?
(A) 0
(B) 1
(C) 2
(D) 3

Explanation: Given, a 4-way set associative cache (initially empty) with total 16 cache blocks. Therefore, total 4 sets are possible numbered 0 to 3. Each set has 4 block.

Given memory blocks are 0, 1, 4, 3, 8, 133, 159, 129, 63, 8, 48, 32, 73, 155 mod 4 gives, 0, 1, 0, 3, 0, 1, 3, 1, 3, 0, 0, 0, 1, 3.

Set 0 has 4 blocks and {0, 4, 8, 8, 48, 32} requests. Only one hit (i.e., request 8) occurred.

Set 1 has 4 blocks and {1, 133, 129, 73} requests. Zero hit occurred.

Set 2 has 4 blocks and {} request. Zero hit occurred.

Set 3 has 4 blocks and {3, 159, 63, 155} requests. Zero hit occurred.

So, option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.