Experiments On Page Size, Program Access Patterns, and Virtual Memory Performance
Experiments On Page Size, Program Access Patterns, and Virtual Memory Performance
Experiments On Page Size, Program Access Patterns, and Virtual Memory Performance
Hatfield
Abstract: The assumption about virtual memory systems that as overhead (time for access and software page management) decreases
page size should be reduced is not alwaysa good one. Recent experiments indicatethat larger page sizes can provide better performance
for programs that make highly localized use of memory space.
I ::
9vailable memory
Figure 2 Page exceptions for program A.
D. J . HATFIELD I B M 1. RES.
DEVELOP.
200(
1.14
34 - 1000
-
32 -'
30 ,--
28 -
2
.-
3
x
P
6
E .vailable memory
8
Figure 4 Page exceptions for program A after repackaging.
2n
-
6
-
search is made may be distributed in the same manner
I Execution time through small and large pages, so that the depthof search
Figure 3 Memory usage by program A after repackaging. would be the same. Sinceit is easy tostipulate conditions
that would favor either size, the software overhead 6 was
assumed to be the same for both cases.
The number of small page exceptions that can be pro-
and the small page size. The transfer time will be p for
cessed in the time it takes to process onelarge page ex-
the large page size and p/2 for the small. The software
ception is
overhead to replace a page is difficult to determine as a
function of page size. There are potentially more small a+P+G
pages to look through, but the condition for which the 61
22
20
I8
-
II Execution time "+
Figure 5 Memory usage by program B.
packed program favored the larger page size throughout Figure 6 Page exceptions for program B.
most of the desirable performance region. For programs
with greater localization of heavily used memory, the bias
to the large page size is also greater (Figs. 5 and 7). Both
of these programs have a more stable working set and It was not difficult to find examples of page request
show a sharper bend in the page exception curve than do sequences giving two, three, and fourtimes the numberof
either the original or the repackaged version of the first exceptions for the smallerpagesize. The examples in
program. And in the page exception graphs (Figs. 6 and Fig. 9 are simple sequences that parallel the activity of
8) the smaller page size often resulted inmore than twice realprogramsin anenvironment involving more real
theexceptions,contrarytoour intuitive expectations. pages and longer stringsof requests between page excep-
After checking our page replacement simulators and find- tions. The vertical boxes at the left represent an initial
ing no logical errors, we tried to find models that would stack of pages ordered for removal when a page excep-
62 predict ratios in excess of two :one[ 51. tion occurs. The bottommost member of the stackis to be
1000
2
.-
BB
0
k I I I I I I
40K 80K 120K 160K 200K 240K
.vailable memory
01
b Figure 8 Page exceptions for program C.
P
D
P-
instruction or data reference spanning a half-page bound-
IExecution time "-+ ary was less than one percent in the real programs ex-
Figure 7 Memory usage by program C. amined. In other words, if we consider a string of pro-
gram instructionstranslatedinto page references (@ne
or morepage references perinstruction) first for pages of
removed first. Corresponding to two requests for large size n and then for pages of size n/2,the page reference
page i are two requests for either one or both halves of strings for n and n/2 are essentially thesame length.
the page as some combination of the numbers 2i and 2i - Note that such a reference string is not the same length
1. Page requests that cause page exceptions are under- as the compressed string of page sets given to the page
lined in both cases. In thefirst and second and the fourth managementsimulator. For the single-user case, how-
and fifth examples, the request sequence and exception ever, both the full and the compressed stringcontain the
pattern can cycle indefinitely. This is because the
removal same information.
stack at an earlier position in the sequence is reestab- These examples all have somethings in common. Most
lished later in the sequence, defining a cycle that will of the time, both halves of the large page are used. Page
regenerate itself as many times as desired. In these cases, exceptions for thelarge page are farenough apart so that
the number of exceptions given is that for one cycle (all between the corresponding small page exceptions there
examples arefor single page sequences,butcan be are more than enough changes of state to significantly re-
broken into sets withoutdestroying the phenomenon). order the stack. On the other hand, between the times of
It should be emphasized that these sequences are the the large page exceptions, the stack is not significantly
result of the accessing patterns of programs and not an reordered. The large page that causes a page exception
artifact resulting from an instruction or a word of data usually corresponds to twosmall page requests, and both
spanning a half-page boundary. The occurrence of an usually cause a page exception. These conditions would 63
65 12 44 6 6 3 4 12 56
FIFO:
22 33
11
33 44 33 44 11 44 33 11 44 11
33 2 2 44 33 22 33 22 44 33 1 1 22 4 4 . . . 3 exceptions
33 56 12 56 17 56 78 78
22 56 12 77 56 12 34 78 _56 34 56 34 7s 56 12 23 78.. . 14exceptions
*-
65 21.. .16 exceptions
be expected from programs characterized as high-density shows LRU replacement appliedto theprogram shown in
users of memory, and for those programs only when the Fig. 7 for FIFO. As yet we have been unable to prove
paging rate for the large page size is relatively low (i.e., that there is a replacement algorithm using only the past
the righthand side of the graphs). In addition, the stipula- history of page requests that cannot generate more than
tion that the removal stack for the large page size not be twicetheexceptions with half size pages. Figure 11
reordered by the time a page exception occurs would im- shows the program displayed in Fig. 5 passed by a re-
ply that the phenomenon is more likely to occur with placement algorithm that selects a page for removal by
FIFO than with least recently used (LRU) replacement. examining a single "used" bit for thepage. It caneasily be
This follows because the FIFO stack can change only shown that the MIN algorithm, which gives the minimum
at page exception time, while the LRU stack canchange number of page exceptions for any requeststring, cannot
with every instruction. This has been observed experi- produce more than twice the exceptions for thehalf page
mentally, with the LRU algorithm seldom giving an ex- size[ 111. But for other algorithms, especially those in
64 ceptionratio greaterthan 2: 1 for real programs. Figure 10 use today, there seem to be no guarantees.
501
/Available memory
real programs resemble these models. Figure 11 “Used bit” replacement for program B.
For instance, the amountof memory space involved in
a memory cycle can be the determining factor. If a pro-
gram is cycling through r pages and has only r - 1 page exception per request, and the large size page will be-
frames available, both LRU and F I F O replacement al- come competitive again with respect to the small. The
gorithms will generate a page exception for every page curve representing the ratio of small to large page excep-
request. If the same program is run on pages half as large, tions will climb as the available space is reduced.
the cycle may involve far fewer than 2r small pages. Any The effect of more than doubling the exceptions for the
cycle using 2(r - 1) or fewer small pages will generate half-size page has beennoted for a large size page of
no page exceptions, compared with one exception per 16,384, 8192, 4096 and 2048 bytes. It is a characteristic
page request with large pages. But if the available space of programs that make highly localized use of memory
is further constricted so that the cycle does not fit for and that therefore perform well on systems using reloca-
either large or small pages, both cases will generate one tion hardware for address translation and is also a char- 65
66