Suppose we have a 16 block cache. Each block of the cache is one word wide. When
ID: 3779339 • Letter: S
Question
Suppose we have a 16 block cache. Each block of the cache is one word wide. When a given program is executed, the processor reads data from the following sequence of decimal addresses: 0, 6, 24, 8, 24, 5, 12, 21, 2, 8, 15, 21, 9, 12, 26 Show the contents of the cache at the end of the above reading operations if: the cache is direct mapped the cache is 2-way set associative the cache is 4-way set associative the cache is fully associative The content at address 0 can be shown as [0]. Assume LRU (Least Recently Used) replacement algorithm is used for block replacement in the cache, and the cache is initially empty.
Explanation / Answer
A good approximation to the optimal algorithm is based on the observation that pages that have been heavily used in the last few instructions will probably be heavily used again in the next few. Conversely, pages that have not been used for ages will probably remain unused for a long time. This idea suggests a realizable algorithm: when a page fault occurs, throw out the page that has been unused for the longest time. This strategy is called LRU (Least Recently Used) paging.
here iam taking page or memory size as 3.
0, 6, 24, 8, 24, 5, 12, 21, 2, 8, 15, 21, 9, 12, 26
The following pages are replaced by using LRU as belove.
0 0 0 8 8 8 12 21 21 21 4 15 15 15 12 6 6 6 6 5 5 5 5 8 8 8 8 9 9 24 24 24 24 24 24 2 2 2 2 21 21 26Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.