Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II: Counter-based clock page replacement algorithm In this part of the assignment, you are to replace the second-chance LRU approximation algorithm in both the

Part II: Counter-based clock page replacement algorithm

In this part of the assignment, you are to replace the second-chance LRU approximation algorithm in both the active and inactive lists with a counter-based clock algorithm:

1. Keep a reference counter for each frame, which is set to 0 initially.

2. When try_to_free_pages() is called, you scan a frame in the following way. First, you add the reference bit value to the frame reference counter (and clear the reference bit at the same time). Then you check the frame reference counter. If the counter is 0, you evict the page. Otherwise, you decrement the counter by 1 and move the frame to the back of list (as the original second-chance LRU approximation normally does).

3. Action #2 (above) alone will result in a replacement algorithm equivalent to the original second-chance LRU approximation. To effectively utilize the frame reference counter, you need additional counter maintenance from other events. To this end, you should scan the frames periodically (e.g., as part of the timer interrupt) and add the reference bit value to the frame reference counter (and clear the reference bit at the same time).

4. Note that the frame reference counter may overflow. If the frame reference counter is already at its maximum value, keep it unchanged when adding the reference bit to it.

Note that you are only being asked to replace the existing LRU approximation algorithm in each list with a new one. You can leave the basic Linux two-list memory management in place. Also, you do not need to make any changes to how Linux handles dirty page eviction. If a frame to be freed contains a dirty page, it will have to be swapped out, but this should not affect your decision on which frame to free.

Write a user program that you can use to test your page replacement implementation and compare it against the default page replacement algorithm in Linux. Include in your learning report an explanation of how it works and why it is useful for comparing the page replacement implementations. Describe the experiments you ran and explain the measurements you obtained. Explain the different performance of the two algorithms (or the lack thereof) and how this is justified based on the design/implementation of the two algorithms.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago