Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Rechnerarchitektur-Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oh14.dev
Rechnerarchitektur-Tools
Commits
baba1aa5
Verified
Commit
baba1aa5
authored
2 years ago
by
Jonas Zohren
Browse files
Options
Downloads
Patches
Plain Diff
Add explanation
parent
816e61ba
No related branches found
No related tags found
No related merge requests found
Pipeline
#98453
passed
2 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/routes/lru/+page.svelte
+32
-3
32 additions, 3 deletions
src/routes/lru/+page.svelte
with
32 additions
and
3 deletions
src/routes/lru/+page.svelte
+
32
−
3
View file @
baba1aa5
...
@@ -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"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment