Skip to content
Snippets Groups Projects
Verified Commit baba1aa5 authored by Jonas Zohren's avatar Jonas Zohren :speech_balloon:
Browse files

Add explanation

parent 816e61ba
No related branches found
No related tags found
No related merge requests found
Pipeline #98453 passed
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
let numCacheEntries = 4; let numCacheEntries = 4;
let valuesQueued = '1,2,3,4,5,6,7,6,8,5,9'; let valuesQueued = '1,2,3,4,5,6,7,6,8,5,9';
let oldestEntry = 0;
$: lruMatrix = makeLruMatrix(numCacheEntries); $: lruMatrix = makeLruMatrix(numCacheEntries);
/** @type {string[]} */ /** @type {string[]} */
...@@ -92,7 +93,35 @@ ...@@ -92,7 +93,35 @@
} }
</script> </script>
<h1>LRU mit Dreiecksmatrix</h1> <h1>LRU Matrix</h1>
<fieldset>
<details>
<summary>What is this all about?</summary>
<p>Most modern CPUs use three layers of extremely fast caches, called L1, L2 and L3.</p>
<p>
These caches have limited capacity. If they are full, some old value must be evicted to make
place for a new one. An effective method to choosing which value to evict is called <em
>LRU</em
>
(<em>Least Recently Used</em>).
</p>
<p>
LRU means: The value that was least recently used (~= the oldest one) is to be removed. To
make this work, the cache must keep track of which item is the oldest. In Software, you might
use a linked list, where you bring an item to the start whenever it is accessed, leaving the
last item as the least recently used one.
</p>
<p>
In hardware though, this is inefficient. Therefor, the lecture introduced a method called <em
>LRU Matrix</em
>. It encodes the information
<i>›slot i contains an older (= less recently used) item than slot j‹</i> using a 2D-grid
<code>lru[i][j]</code>, where 1 denotes slot i being less recently used compared to slot j.
</p>
<p>This tool allows you to play around with that concept and test your assumptions :)</p>
</details>
</fieldset>
<fieldset> <fieldset>
<label for="num-cache-entries-slider"> <label for="num-cache-entries-slider">
...@@ -126,8 +155,8 @@ ...@@ -126,8 +155,8 @@
{/each} {/each}
</table> </table>
<p>Def: f [i,j] = 1, falls Zugriff auf i älter ist als der auf j</p> <p>Def: f [i,j] = 1, if access to i is older than the access to j</p>
<p>Def: f [i,j] = 0, falls Zugriff auf i jünger ist als der auf j</p> <p>Def: f [i,j] = 0, if the access to i is younger than the access to j</p>
<h2>Cache entries</h2> <h2>Cache entries</h2>
<table border="1"> <table border="1">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment