Develop a test program that triggers a change in the


Task 1

you are to add a static system call to your kernel which will collect and return to user space callers the following memory management statistics:

1. the current number of free pages (over all memory zones);

2. the current number of pages used by slab allocator (over all memory zones);

3. the current number of pages in the active list (over all memory zones);

4. the current number of pages in the inactive list (over all memory zones);

5. the current number of pages in the active list whose reference bits are set (over all memory zones);

6. the current number of pages in the inactive list whose reference bits are set (over all memory zones);

7. the cumulative number of pages moved from the active list to the inactive list (since the last machine boot);

8. the cumulative number of pages evicted from the inactive list (since the last machine boot);

Follow steps similar to the ones you took to develop the pinfo static system call that you developed in assignment 2.

Develop a test program that triggers a change in the statistics above, report them on standard output, reason about the change and document on learning report deliverable to be submitted as part of this assignment. Taking statistic 8 (the cumulative number of pages evicted from the inactive list) as an example, you should provide a program that triggers additional page evictions from the inactive list so the reported statistics 8 will change after you run the program. It is OK to use one combo program to trigger the changes of multiple statistics as long as you clearly document and reason about why these changes occurred.

Task 2

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

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Develop a test program that triggers a change in the
Reference No:- TGS01533246

Expected delivery within 24 Hours