C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Finding Optimal Page SizeWe have seen that the bigger page table size cause an extra overhead because we have to divide that table into the pages and then store that into the main memory. Our concern must be about executing processes not on the execution of page table. Page table provides a support for the execution of the process. The larger the page Table, the higher the overhead. We know that, Page Table Size = number of page entries in page table X size of one page entry Let's consider an example, Virtual Address Space = 2 GB = 2 X 2 ^ 30 Bytes Page Size = 2 KB = 2 X 2 ^ 10 Bytes Number of Pages in Page Table = (2 X 2 ^ 30)/(2 X 2 ^ 10) = 1 M pages There will be 1 million pages which is quite big number. However, try to make page size larger, say 2 MB. Then, Number of pages in page table = (2 X 2 ^ 30)/(2 X 2 ^ 20) = 1 K pages. If we compare the two scenarios, we can find out that the page table size is anti proportional to Page Size. In Paging, there is always wastage on the last page. If the virtual address space is not a multiple of page size, then there will be some bytes remaining and we have to assign a full page to those many bytes. This is simply a overhead. Let's consider, Page Size = 2 KB Virtual Address Space = 17 KB Then number of pages = 17 KB / 2 KB The number of pages will be 9 although the 9th page will only contain 1 byte and the remaining page will be wasted. In general, If page size = p bytes Entry size = e bytes Virtual Address Space = S bytes Then, overhead O = (S/p) X e + (p/2) On an average, the wasted number of pages in a virtual space is p/2(the half of total number of pages). For, the minimal overhead, ∂O/∂p = 0 -S/(p^2) + ½ = 0 p = √ (2.S.e) bytes Hence, if the page size √(2.S.e) bytes then the overhead will be minimal.
Next TopicVirtual Memory
|