Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a fully associative cache with 8 cac... Start Learning for Free
Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:
4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7
If LRU replacement policy is used, which cache block will have memory block 7?
  • a)
    4
  • b)
    5
  • c)
    6
  • d)
    7
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Consider a fully associative cache with 8 cache blocks (numbered 0-7) ...
When 45 comes, the cache contents are 4 3 25 8 19 6 16 35
LRU array (first element being least recently used) [4 3 19 6 25 8 16 35]
So, 45 replaces 4 45 3 25 8 19 6 16 35 [3 19 6 25 8 16 35 45]
Similarly 22 replaces 3 to give
45 22 25 8 19 6 16 35 [19 6 25 8 16 35 45 22]
8 hits in cache 45 22 25 8 19 6 16 35 [19 6 25 16 35 45 22 8]
3 replaces 19 45 22 25 8 3 6 16 35 [6 25 16 35 45 22 8 3]
16 and 25 hits in cache
45 22 25 8 3 6 16 35 [6 35 45 22 8 16 25 3]
Finally 7 replaces 6, which is in block 5.
So, answer is (B)
View all questions of this test
Most Upvoted Answer
Consider a fully associative cache with 8 cache blocks (numbered 0-7) ...
To determine which cache block will have memory block 7 using the LRU (Least Recently Used) replacement policy, we need to simulate the cache behavior for the given memory block requests.

Here are the steps to solve this problem:

1. Initialize the cache:
- As the cache is fully associative, all cache blocks are initially empty.

2. Process the memory block requests one by one:
- For each memory block request, check if the requested block is already present in the cache.
- If it is present, update the cache block accessed time to the current time.
- If it is not present, find the least recently used (LRU) cache block (i.e., the one with the smallest accessed time) and replace it with the requested block. Update the accessed time of the replaced block to the current time.

3. Determine the cache block for memory block 7:
- After processing all the memory block requests, the cache block that contains memory block 7 will be the one with the smallest accessed time.

Let's go through the memory block requests and simulate the cache behavior:

1. Request for memory block 4:
- Cache: [4, -, -, -, -, -, -, -]

2. Request for memory block 3:
- Cache: [4, 3, -, -, -, -, -, -]

3. Request for memory block 25:
- Cache: [4, 3, 25, -, -, -, -, -]

4. Request for memory block 8:
- Cache: [4, 3, 25, 8, -, -, -, -]

5. Request for memory block 19:
- Cache: [4, 3, 25, 8, 19, -, -, -]

6. Request for memory block 6:
- Cache: [4, 3, 25, 8, 19, 6, -, -]

7. Request for memory block 25:
- Cache: [4, 3, 25, 8, 19, 6, -, -] (Cache hit)

8. Request for memory block 8:
- Cache: [4, 3, 25, 8, 19, 6, -, -] (Cache hit)

9. Request for memory block 16:
- Cache: [4, 3, 25, 8, 19, 6, 16, -]

10. Request for memory block 35:
- Cache: [4, 3, 25, 8, 19, 6, 16, 35]

11. Request for memory block 45:
- Cache: [4, 3, 25, 8, 19, 6, 16, 35] (Cache full, LRU block replaced)

12. Request for memory block 22:
- Cache: [4, 3, 25, 8, 19, 6, 22, 35] (LRU block replaced)

13. Request for memory block 8:
- Cache: [4, 3, 25, 8, 19, 6, 22, 35] (Cache hit)

14. Request for memory block 3:
- Cache: [4, 3
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer?
Question Description
Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer?.
Solutions for Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer?, a detailed solution for Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7If LRU replacement policy is used, which cache block will have memory block 7?a)4b)5c)6d)7Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev