Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CSI3131 Assignment 4

Groupe 138

Question 1
A page-replacement algorithm should minimize the number of page faults. We can
achieve this minimization by distributing heavily used pages evenly over all of memory, rather than
having them compete for a small number of page frames. We can associate with each page frame
a counter of the number of pages associated with that frame. Then, to replace a page, we can search
for the page frame with the smallest counter.

a. Define a page-replacement algorithm using this basic idea. Specifically address


these problems:
i. What the initial value of the counters is
ii. When counters are increased
iii. When counters are decreased
iv. How the page to be replaced is selected

We will set the initial values for the counters to 0, the counters should be increasing only when a page
fault is present in the page frame. If a page fault is detected, the page will be set to memory with a
value of 1. The page with the smallest number will be replaced. If there are pages with the same
number of occurrences, we follow a FIFO structure to remove pages.
b)

15 page faults were detected

c)
11 page faults were recorded

Question 2 and 3 are attached in the zip file.

You might also like