Paging

A Memory Management Technique



Page : one of numerous equally sized chunks of memory

Page Table: stores where in memory each page is

Main Memory : divided into page frames, a space large enough to hold one page of data
( e.g. 4k )

Swap Space :


Address Translation with Paging

1. page number = A / page_size

Example Address (in binary):
---------------------------------------
| 10101010101010101010 | 101010101010 |
---------------------------------------

2. offset = A mod page_size

Now calculate the physical address:

To compute the physical address:

  1. look up the page number in the page table and obtain the frame number
  2. to create the physical address, frame = 17 bits; offset = 12 bits; then
Effective Memory Access Time
The percentage of times that a page number is found in the associative registers is called the hit ratio. An 80-percent hit ratio means that we find the desired page number in the associative registers 80 percents of the time. If it takes 20 nanoseconds to search the associative registers, and 100 nanoseconds to access memory, then a mapped memory access takes 120 nanoseconds when the page number is in the associative registers. If we fail to find the page number in the associative registers (20 nanoseconds), then we must first access memory for the page table and frame number (100 nanoseconds), and then access the desired byte in memory (100 nanoseconds), for a total of 220 nanoseconds. To find the effective access time, we must weigh each case by it probability:
effective access time = 0.80 * 120 + 0.20 * 220 
= 140 nanoseconds.

In this example, we suffer a 40-percent slowdown in memory access time (from 100 to 140 nanoseconds).
For a 98-percent hit ratio, we have

effective access time = 0.98 * 120 + 0.02 * 220
                      = 122 nanoseconds

The increased hit rate produces only a 22-percent slowdown in memory access time.
The hit ratio is clearly related to the number of associative registers. With the number of associative registers ranging between 16 and 512, a hit ratio of 80 to 98 percent can be obtained.

To do page table look-ups quickly:

Page Fault

Address: can be an address of an instruction, or of data (heap, stack, static, variables)


Paging Operations

1. Fetch policy

a) demand fetching = demand paging

b) anticipatory fetching = prepaging

There are three variations:

i) working set prepaging

ii) clustering prepaging

iii) advised prepaging

2. Placement Policy

3. Replacement Policy

Local versus Glogal Page Replacement:




Table of Contents