# Operating System Paging concept

I am quoting a paragraph from the book "Operating System Principles" by Galvin.

Usually, each page-table entry is 4 bytes long, but that size can vary as well. A 32-bit entry can point to one of $2^{32}$ physical page frames. If frame size is 4 kB, then a system with 4-byte entries can address $2^{44}$ bytes (or 16 TB) of physical memory.

Now, I know we have $2^{44}$ bytes of memory because we have $2^{32}$ page frames and each frame size is 4 kB, i.e. $2^{12}$ bytes of memory, so physical memory is $2^{32}\cdot2^{12} = 2^{44}$.

1. How did we get the number of frames as $2^{32}$?

2. If the logical memory space is $2^{32}$ then what should the physical memory space be (considering both the fully used and partially used logical address space concept)?

• 32 ... 32 ... I think I have seen that earlier in the question! Oct 24 '14 at 17:01
• @babou...i didn't understand your comment Oct 24 '14 at 17:16
• He's pointing out that you already answered your own question in your quote: "A 32-bit entry can point to one of $2^{32}$ physical page frames" Oct 24 '14 at 18:02
• @WanderingLogic..but a 32-bit entry makes 2^32 logical address space, how is the number of frames becoming 2^32 Oct 24 '14 at 18:39
• The bits in the PTE are the page frame number (though this does not leave any room for a valid bit, accessed/modified bits, permission bits, and other metadata). Oct 24 '14 at 18:43

I found (surprisingly many) copies of that text on the web (see http://www.slideserve.com/janna/virtual-memory). That helps ascertaining there is no vocabulary mismatch.

The 32-bit entry makes for $2^{32}$ physical (not logical as you write in your comment) address space for pages, i.e. $2^{32}$ frames. The address of the logical page is used for indexing the page-table, and the 4 bytes content of the corresponding entry of the page table is the address of a page frame, i.e. a physical page.

So you have $2^{32}$ physical pages. But there is nothing in the above text that tells the size of the logical space. It could be much larger, with logical page addresses of 8 bytes, or it could be smaller which did happen on some architectures. For more details on this, see this discussion regarding virtual memory on 32 bits hardware. There may be other issues with more recent 64 bits hardware. The size of the page-table would tell you what is the size of the virtual memory space, i.e. of logical addresses.

Does this clarifies the problem?

Page frames are units of physical memory. Whether your system actually has $2^{32}$ page frames is a question of how much physical memory it has. The point is that having a page table where each page frame is indexed through 32 bits allows you to address up to $2^{32}$ page frames.

Your second question doesn't really make sense as page frames are physical memory.

## 1

Consider, you have a page table off course which will give you frame number corresponding to given page number. And you have specified that page table entry size is 32 bit.Ahhh.. what this 32 bit means(i think u really got stuck here):

let if u consider this 32 bit as 2 bit(not possible but let it) then how many different combinations you have?

-00 - 01 - 10 - 11

=2^2 (hmmm) hence when you take 32 bits, no of combination possible would be 2^32 means number of the frame in memory can reach up to 2^32 in number.

## 2

logical and physical addresses generally independent of each other that is if you have a memory of 2MB=2^21 byte still you can take a logical address space of 3 MB OR 1GB etc etc..condition is that we must keep logical address space greater than physical address space since you can't address all physical bytes with a smaller logical address.