The situation in Figure 3.6 assumes there is only one empty page frame available. The
first page is loaded into memory and execution begins, but after executing the last
command on Page 0, the page is swapped out to make room for Page 1. Now execution
can continue with the first command on Page 1, but at the “}” symbol Page 1
must be swapped out so Page 0 can be brought back in to continue the loop. Before
this program is completed, swapping will have occurred 100 times (unless another
page frame becomes free so both pages can reside in memory at the same time). A failure
to find a page in memory is often called a page fault and this example would generate
100 page faults (and swaps).