Lecture 2 Flashcards

1
Q

How does the clock replacement algorithm try to implement LRU?

A

Try to achieve some of the benefits of LRU replacement, but without the computational overhead of LRU.

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

How does the clock replacement algorithm approximate LRU?

A

Uses a reference bit. This reference bit corresponds to a used bit that is set for each page reference.

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

What does it mean if the used bit is not set?

A

The corresponding page has not been referenced in a long time.

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

Where is the used bit for each page usually stored?

A

Page table or Translation Look-aside Buffer(T LB)

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

What makes the used bit fast to access and modify?

A

It is just one bit, stored in cache memory

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

What are the three states the clock replacement algorithm assumes a page can be in when a page reference occurs?

A
  1. Page not in memory
  2. Used-bit = 0, Page in memory but not recently used.
  3. Used bit = 1, Page in memory and recently used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Is it possible to have a page fault when used bit set to 1?

A

No, no page fault will occur when the page is being accessed.

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

What happens when page fault occurs when used bit = 0?

A

Bit is changed to 1 (recently used).

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

How can a page fault occur when used bit = 0?

A

The page is not in main memory but being temporarily stored in the translation look aside buffer (TLB).

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

Which pages does the clock replacement algorithm end up replacing?

A

The clock algorithm thus replaces pages that have not been referenced for one complete revolution of the page pointer.

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

How are the physical page frames in the clock algorithm arranged in a circle?

A

With a circular linked list.

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

What is the goal of the clock algorithm?

A

Replace pages that are old enough and not necessarily the oldest

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

How does the clock algorithm store pages?

A

In circular linked list, with one reference bit per page.

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

What happens when the clock algorithm encounters a page with the reference bit set?

A

Set its reference bit to 0,and advance the clock pointer to the next page.

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

Best case and worst case of clock replacement algorithm.

A

Best - First page has reference bit cleared and is replaced.
Worst - All pages have reference bit set, clock has to loop around entire list and replace the page where the pointer started.

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

Advantage of the Clock replacement algorithm?

A

Maintains only one reference bit for each page, so it is fast and efficient.

17
Q

Disadvantage of Clock replacement algorithm?

A

reference bit only indicates if page was used at all since last checked and not how long it has been since last used.

18
Q

How to get around disadvantage of the Clock replacement algorithm?

A

Have extra reference bits associated with each page.
At each page reference, increment a 8−bit reference for each page to reflect how old a page is, where a page fault, the oldest page is replaced

19
Q

Disadvantage with 8-bit reference strategy?

A

A page fault will require a search through all the pages in the linked list,in order to be sure that the oldest page is replaced.

20
Q

Clock-hand moving slowly.

A

pointer passes few pages before a page is replaced. Many page faults, fewer reference bits set.

21
Q

Clock-hand moving fast.

A

Pointer passes many pages before a page is replaced.
Few page faults.
Reference bits set.

22
Q

Dirty Page

A

A page which is modified in a buffer cache (between swap-out from secondary storage and swap-in to a main memory frame).
Corresponding Dirty bit set in page table.

23
Q

What happens when dirty page is replaced?

A

Must be written to disk (e.g. hard-drive secondary storage) before its page frame is reused.