How to Calculate the Right Page Size
CSC 315
The page size is normally fixed by the computer designer and
cannot be altered by the operating system. The "best" page
size has been the subject of many debates; the following calculation
shows the general principle.
The best page size wastes the least amount of memory for the sum of :
- The page table
- The wasted space in the last page
Assume:
p is the page size
s is the program size in words
p << s
the page table descriptor uses 1 word
So...
The page table requires s/p descriptors
On average, the last page of a program wastes p/2 words
So, the fraction of wasted space (w) in a program is:
w = (s/p + p/2) / s
w = 1/p + p/2s
To find the minimum waste, set dw/dp = 0
dw/dp = -1/p² + 1/2s
0 = -1/p² + 1/2s
1/2s = 1/p²
p = sqrt(2s)
Last updated on 5/16/96