Operating Systems Flashcards

(15 cards)

1
Q

How many Data-TLB entries for 4KB pages in Intel icelake x86_64? What about for 2MB? For 1GB?

Same question for Instr-TLB.

A

Data TLB
- 4KB : 64
- 2MB : 32
- 1GB : 4

Instr TLB
- 4KB : 128
- 2MB : 8
- 1GB : 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does 4-way, 8-way, 16-way, fully-associative TLB signify?

Trade-offs with more/less “ways”?

A
  • gives the number of sets
  • set index is pulled from VPN
  • everything in the set is searched in parallel

Higher (e.g., 8-way, 16-way):
- Fewer collisions, better hit rate
- More complex, slightly slower
Lower (e.g., 2-way, 4-way)
- Faster lookup
- More collisions (conflict misses)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is STLB in Intel Ice Lake?

A

L2 TLB, larger, slower

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

fetch time for L1 TLB vs L2 TLB

A

0.5-1 cycle vs 5-10 cycles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some free space management policies?
When/How to use them?

A
  • free space management policies are used in memory allocators like in malloc, or address sanitizers
  • api is malloc(int size), free(void* ptr)
  • we use splitting and coalescing
  • The Header block is used to store the size of an allocated memory block
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you get infinite TLB misses? How to prevent that?

A
  • When the TLB miss handler’s pages are not in TLB you get infinite…
  • The translations for TLB-miss handler are pinned in the TLB
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Metadata in a TLB entry

A
  • Address space identifier / Global identifier
  • valid
  • dirty
  • caching info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why is TLB so fast

A
  • spatial etc etc
  • but looking for “parallel search”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are inverted page tables

A

mapping from physical page frame to virtual page, instead of the other way around

but who cares, not how intel x86_64 does it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the difference between swap space and page cache

A
  • swap space is for anonymous memory
  • page cache is for file backed pages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Give an example of when LRU misbehaves

A
  • the memory region you’re referencing is one more than the cache size in a loop, so every access is a miss
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

in linux when does a swap daemon run? what is a swap daemon, what does it do, why is it needed?

A
  • kswapd: kernel swap daemon
  • runs when the memory is under pressure
  • kswapd picks a page using LRU, avoiding active/pinned ones.
  • Dirty CPU cache lines for that page are flushed to RAM by hardware (cache coherence).
  • TLB entry is invalidated, and the page is marked non-present in the page tables.
  • Page is written to swap (if dirty) and removed from physical memory.
  • Future access triggers a page fault → kernel reloads it from swap, updates page tables & TLB.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does linux’s page cache work

A
  • 2Q policy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly