2
votes

I came across this line in "Operating System Concepts" by Galvin. It was mentioned as follow,

"Each page table entry is usually 4 bytes long, but that size can vary as well. A 32 bit entry can point to one of the 2^32 physical page frames. If a frame is 4KB then a system with 4 byte entries can address 2^36 bytes of physical memory."

I don't understand how is it 2^36. If anyone could explain.

PS: This is my first stackoverflow question. So I'm sorry if my question is not up to the standards.

2
Please provide more context for the question. See How to Ask and minimal reproducible example for details.Horia Coman
I have updated the question. I hope it provides for some more information.Akash

2 Answers

3
votes

It looks like you are bit wrong with the quote. The book says: "A 32-bit entry can point to one of 2^32 physical page frames. If frame size is 4 KB (2^12), then a system with 4-byte entries can address 2^44 bytes (or 16 TB) of physical memory"

in such representation - the 2^44 is logical. We have 2^32 frames, where each frame, on x32 system, can hold 2^12 entries (4 KB frame size. The entry is 4 bytes - pointer size on x32 systems). So having that: 2^32 * 2^14 = 2^44 - total amount of bytes that frames can hold.

-1
votes

The context is not 100% there, but I think it's enough to provide an explanation.

The page table structure holds the mapping between virtual memory for a process and the physical memory of the computer. The basic unit is the page which has size 4KB, which can be addressed at the byte level by 12 bits.

Now, if the whole address space which can be mapped at the byte level is 2^36 bits, and we're mapping pages, it means the last 12 bits are accounted by the page, leaving the first 24 bits to be provided via the page table. That would map to a page table with roughly 16 million entries. If each entry is 4 bytes, we'd be looking at 64 MB of memory consumed at peak usage. Which seems like a plausible amount.

Each entry has 4 byte/32 bits, and it can identify one of 2^32 distinct pages. And I think the fact that there are only 2^24 entries in the page table is left implicit, and you can only fill a part of the full physical space.