Lecture 2 Flashcards
How does the clock replacement algorithm try to implement LRU?
Try to achieve some of the benefits of LRU replacement, but without the computational overhead of LRU.
How does the clock replacement algorithm approximate LRU?
Uses a reference bit. This reference bit corresponds to a used bit that is set for each page reference.
What does it mean if the used bit is not set?
The corresponding page has not been referenced in a long time.
Where is the used bit for each page usually stored?
Page table or Translation Look-aside Buffer(T LB)
What makes the used bit fast to access and modify?
It is just one bit, stored in cache memory
What are the three states the clock replacement algorithm assumes a page can be in when a page reference occurs?
- Page not in memory
- Used-bit = 0, Page in memory but not recently used.
- Used bit = 1, Page in memory and recently used.
Is it possible to have a page fault when used bit set to 1?
No, no page fault will occur when the page is being accessed.
What happens when page fault occurs when used bit = 0?
Bit is changed to 1 (recently used).
How can a page fault occur when used bit = 0?
The page is not in main memory but being temporarily stored in the translation look aside buffer (TLB).
Which pages does the clock replacement algorithm end up replacing?
The clock algorithm thus replaces pages that have not been referenced for one complete revolution of the page pointer.
How are the physical page frames in the clock algorithm arranged in a circle?
With a circular linked list.
What is the goal of the clock algorithm?
Replace pages that are old enough and not necessarily the oldest
How does the clock algorithm store pages?
In circular linked list, with one reference bit per page.
What happens when the clock algorithm encounters a page with the reference bit set?
Set its reference bit to 0,and advance the clock pointer to the next page.
Best case and worst case of clock replacement algorithm.
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.