The reasons for
replacing
program pages inside
memory frames
Page requests from the
execution of a computer program
- Consider the following
computer program we
nested loops:
|
Page requests from the
execution of a computer program
- The CPU will
first
fetch instructions
from
program page 0
in the program:
- Instructions that
do not use
memory variables can be
executed without
additional
memory access operation
|
Page requests from the
execution of a computer program
-
Occasionally,
the CPU
fetches
a
ldr/str instruction:
- Since the
variables are
stored in a
different part in the
program, a
ldr/str instruction
will need to
access
a
different
program page
|
Page requests from the
execution of a computer program
- The
execution of
a computer program will
result in
a series of
page requests:
- Notice that there
may be
consecutive requests
for the
same
page #
|
Page requests from the
execution of a computer program
-
Only the
first page request
in a series for the
same page
can cause a
page fault
- Because the
same pages will
remain in memory
until another
page fault
occurs
|
Page requests from the
execution of a computer program
-
Hence,
to study the
page replacement
algorithm,
we
can
summarize
the page requests:
- The
performance of
paging
depends on
the
page replacement policy
used.
next
|
Commonly used
page replacement policies
- There are 3 effective
page replacement
policies:
-
First In First Out (FIFO)
- The policy is
simple to
implement
- This policy can
result in a
high number of
page faults
|
-
Least Recently Used (LRU):
- This policy has the
least number of
page fault
- The run time complexity to
find the smallest time stamp is
O(n)
|
-
Second chance:
- An
approximation algorithm for
LRU
- Used today in all
operating systems with
paging
|
|
|
❮
❯