Page 186 - DCAP103_Principle of operating system
P. 186

Unit 5: Memory Management



            5.10 Overview of Page Replacement                                                     Notes

            In our presentation so far, the page-fault rate has not been a serious problem, because each page
            has faulted at most once, when it is first referenced. This representation is not strictly accurate.
            If a process of ten pages actually uses only one-half of them, then demand paging saves the
            I/O necessary to load the five pages that are never used. We could also increase our degree
            of multiprogramming by running twice as many processes. Thus, if we had 40 frames, we
            could run eight processes, rather than the four that could run if each required 10 frames (five
            of which were never used). If we increase our degree of multiprogramming, we are over-
            allocating memory. If we run six processes, each of which is ten pages in size, but actually
            uses only five pages, we have higher CPU utilization and throughput, with 10 frames to
            spare. It is possible, however, that each of these processes, for a particular data set, may
            suddenly try to use all ten of its pages, resulting in a need for 60 frames, when only 40
            are available. Although this situation may be unlikely, it becomes much more likely as
            we increase the multiprogramming level, so that the average memory usage is close to
            the available physical memory. (In our example, why stop at a multiprogramming level
            of six, when we can move to a level of seven or eight?) Further, consider that system
            memory is not used only for holding program pages. Buffers for 1/0 also consume a
            significant amount of memory. This use can increase the strain on memory-placement
            algorithms. Deciding how much memory to allocate to I/O and how much to program
            pages is a significant challenge. Some systems allocate a fixed percentage of memory
            for  I/O  buffers,  whereas  others  allow  both  user  processes  and  the  I/O  subsystem  to
            compete for all system memory. Over-allocation manifests itself as follows. While a user
            process is executing, a page fault occurs. The hardware traps to the operating system,
            which checks its internal tables to see that this page fault is a genuine one rather than
            an illegal memory access. The operating system determines where the desired page is
            residing on the disk, but then finds that there are no free frames on the free-frame list:
            All memory is in use. The operating system has several options at this point. It could
            terminate the user process. However, demand paging is the operating system’s attempt
            to improve the computer system’s utilization and throughput.

                                   Figure 5.26: Memory-mapped Files


































                                             LOVELY PROFESSIONAL UNIVERSITY                                   179
   181   182   183   184   185   186   187   188   189   190   191