22. Swapping Policies Flashcards

1
Q

What is average memory access time (AMAT)?

A

Cost of Accessing Memory + (Probability cache miss * cost of accessing disk)

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

What is the optimal replacement policy?

A

Assuming we have all the future page access data, we evict the page that will be accessed furthest in the future.

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

What is cold-start miss?

A

Cache miss in an empty cache state (unavoidable)

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

What is capacity miss?

A

Cache had to evict an item because the cache run out of space to add a new item

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

What is conflict miss?

A

Cache could not store an item because it is not fully associative. OS pages are fully associative

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

What is the FIFO replacement algorithm?

A

Evicts the page that arrives first

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

What is the random replacement algorithm?

A

Evicts a random page

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

What is the least recently used (LRU) algorithm?

A

Evicts the page that is the least recently used

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

What is the least frequently used (LFU) algorithm?

A

Evicts the page that is the least frequently used

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

What is the most recently used (MRU) algorithm?

A

Evicts the page that is the most recently used

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

What is the most frequently used (MFU) algorithm?

A

Evicts the page that is the most frequently used

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

What hardware support do we need to approximate LRU?

A

A use bit (aka reference bit) for every page. 1 indicates it was used, 0 means it wasn’t used

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

How does the clock algorithm work?

A

When a replacement is needed, it will scan for the first page that has a use bit of 0. If the use bit is 1, it will reset to 0 and move forward until it finds a suitable candidate for eviction.

This is done in a circular queue manner

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

What does the dirty bit do?

A

To indicate if the page that is in memory has been modified. If the page has been modified, the dirty bit is set to 1. This is because eviction of a clean page is free, but a dirty page has to be written to disk

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

What are page selection algorithm for?

A

To choose when to bring a page into memory

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

How does the OS write pages out of disk?

A

They typically do them in clusters because it is more efficiently than doing multiple small writes

17
Q

What is prefetching?

A

Predicting which page will be used and fetching it beforehand

18
Q

What is thrashing?

A

When the system is constantly paged

19
Q

What are some methods of solving thrashing?

A
  1. Admission control: the OS decides not to run a subset of processes
  2. Out-of-memory killer: the OS kills the most memory-intensive process
  3. Buy more memory
20
Q
A