0
$\begingroup$

I am recently studying the operating system, and I found the paging system a little bit confusing, for example, what will happen when there is a 52-bit virtual address and a 40-bit physical address, with 4KiB page size, so there are 2^40 pages and 2^28 frames, how pages are mapped in this case (the pages are more than frames) and how would the page table look like? Any help would be appreciated.

$\endgroup$
3

1 Answer 1

2
$\begingroup$

Physical addresses refer to existing RAM memory. At any time, virtual pages can be mapped to physical pages (frames), or be swapped out on disk. Usually, just a subset of the virtual space is mapped (the rest being completely ignored by the process). That part is mapped to frames as long as they are available (possibly in competition with other processes). The rest is mapped to disk.

The mapping being quite dynamic, there is no particular relation between the virtual and physical addresses, and even less between their sizes. In theory, a single frame of RAM could be enough.

$\endgroup$
5
  • $\begingroup$ Do you mean the excess pages will not be mapped to the RAM memory but kept in the disk, when it is needed, other pages in the RAM will be swapped out (page replacement occurs), is that correct? If correct, what would the page table look like? Will there be some frames mapped by more than one page? $\endgroup$
    – Eric
    Nov 30, 2022 at 15:44
  • $\begingroup$ @Eric: A frame can be mapped to several pages in case of memory sharing between different processes. $\endgroup$
    – user16034
    Nov 30, 2022 at 16:24
  • $\begingroup$ So the page table will only map some pages to frames, if I want to calculate the size of the page table, it should be (frame number * entry size) instead of (page number * entry size), is that right? $\endgroup$
    – Eric
    Dec 1, 2022 at 5:39
  • $\begingroup$ @Eric: yes but the page table can also be paged. $\endgroup$
    – user16034
    Dec 1, 2022 at 8:32
  • $\begingroup$ Got it, many thanks! $\endgroup$
    – Eric
    Dec 6, 2022 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.