Next: Problem 5 - TSP
Up: Information Science II
Previous: Problem 1 - Databases
Let
be the number of page faults in executing a page request sequence
using
pages
in main memory. Suppose that initially there is no page in the main memory, and only demand paging is performed.
Answer the following questions.
- 1.
- Suppose that LRU (Least Recently Used) is used for a page replacement algorithm. In requesting each page,
sort the pages requested so far in the order of most recently requested ones, and count the number of times
such that the requested page is in the th position from the top of the list. Let
be the number of
counts over all . Show a formula to compute
using
and the length
of .
- 2.
- For the following page request sequence
for each , find the value of
when the LRU algorithm is used, and find the minumun value of
when any algorithm is used for page replacements. Use case analysis in respect of .
- 3.
- Concerning the FIFO replacement algorithm, show that
holds for some
using the
sequence in 2.
- 1.
-
Indeed, we can suppose that you have a page fault for every reference
made to the memory, minus all the times we have referenced a page that
was already at the position of one of the
physical pages.
- 2.
- We have the following succession of memory states with LRU. A memory state
is a stack on the top of which the least recently referenced page is put.
Thanks to the table above, we determine the number of page faults when using
different number of frames.
An optimal algorithm states that the page that should be replaced is the
one that will not be used for the longest period of time.
For :
For :
For :
For :
- 3.
- FIFO (First In First Out) is the simplest page-replacement algorithm.
When a page must be replaced, the oldest page in the queue is chosen.
When a page must be brought, it is inserted at the tail of the queue.
For :
That is,
For m=4:
That is, .
Intuitively it seems that the more page frames the memory has, the fewer
page faults a program will get. But this not always the case. This is the
Belady's anomaly.
Next: Problem 5 - TSP
Up: Information Science II
Previous: Problem 1 - Databases
Reynald AFFELDT
2000-06-08