part ii counter based clock page replacementalgorithm in this part of the assignment 4949254
Part II: Counter-based clock page replacementalgorithm In this part of the assignment, you are to replace thesecond-chance LRU approximation algorithm in both the active andinactive lists with a counter-based clock algorithm: 1. Keep a reference counter foreach frame, which is set to 0 initially. 2. When
try_to_free_pages
(
) is called, you scana frame in the following way. First, you add the reference bitvalue to the frame reference counter (and clear the reference bitat the same time). Then you check the frame reference counter. Ifthe counter is 0, you evict the page. Otherwise, you decrement thecounter by 1 and move the frame to the back of list (as theoriginal second-chance LRU approximation normally does). 3. Action #2 (above) alone willresult in a replacement algorithm equivalent to the originalsecond-chance LRU approximation. To effectively utilize the framereference counter, you need additional counter maintenance fromother events. To this end, you should scan the frames periodically(e.g., as part of the timer interrupt) and add the reference bitvalue to the frame reference counter (and clear the reference bitat the same time). 4. Note that the frame referencecounter may overflow. If the frame reference counter is already atits maximum value, keep it unchanged when adding the reference bitto it. Note that you are only being asked to replace the existing LRUapproximation algorithm in each list with a new one. You can leavethe basic Linux two-list memory management in place. Also, you donot need to make any changes to how Linux handles dirty pageeviction. If a frame to be freed contains a dirty page, it willhave to be swapped out, but this should not affect your decision onwhich frame to free. Write a user program that you can use to test your pagereplacement implementation and compare it against the default pagereplacement algorithm in Linux. Include in your learning report anexplanation of how it works and why it is useful for comparing thepage replacement implementations. Describe the experiments you ranand explain the measurements you obtained. Explain the differentperformance of the two algorithms (or the lack thereof) and howthis is justified based on the design/implementation of the twoalgorithms. . . .