Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am reading the new book, Windows Internals 5 about memory management (chapter 9 in Physical Address Extension PAE section). It is mentioned "A 32-bit system represents physical addresses internally with 24 bits" on page 770. I am totally confused, and I think x86 physical memory should be also addressed by 32-bit, and it is why the system is called 32-bit system.

Any ideas what is wrong?

Thanks in advance,
George

share|improve this question
add comment

6 Answers 6

I think the confusion here may be as a result of physical addressing vs virtual addressing. On 32 bit Windows, a virtual memory address (i.e. that which is used by applications and other higher level processes) is 32 bit. Physical memory addresses are down at the level of talking directly to the hardware, which is (1) forbidden for pretty much anything outside of the kernel/HAL, and (2) an implementation detail, so what goes on there could certainly appear weird in more instances than just this.

share|improve this answer
    
Thanks for your clarification, I am confused why 24-bit physical memory address could meet 32-bit virtual memory requirement? I think physical memory should be of more (or at least) 32-bits in order to serve 32-bit memory space of virtual memory. Any comnments? –  George2 Sep 20 '09 at 10:49
3  
Phyiscal and virtual address spaces are entirely separate: for example, my 64-bit processor provides a 64-bit virtual address space, but only has a 48-bit physical address bus. (To allow for easy expansion in the future, the physical address space is 64 bits wide, with a defined 'hole' -- but this isn't required). Older 32-bit chips did something similar, while later ones provided a larger physical address space than virtual. Virtual address space defines what running processes see; physical address space defines what the kernel sees. The two don't need to bear any relation to each other. –  Stephen Veiss Sep 20 '09 at 11:34
add comment

Clearly incorrect. For an accurate treatment of PAE, check out Wikipedia: link text

share|improve this answer
    
Incorrect for what points? Memory is not addressed by 24-bit? You mean Mark is wrong? -:) –  George2 Sep 20 '09 at 7:59
    
"Clearly incorrect"? Care to point out why it is incorrect? –  Joshua Sep 20 '09 at 21:54
    
I was responding (a bit too literally) to what George wrote. The book's passage needs clarification if George excerpted from it verbatim. –  user20101 Sep 22 '09 at 12:27
add comment

I haven't read that exact passage in the book, but I think I can tell what it's getting at.

Memory is broken up by the processor into "pages." Each page is, on an x86 or x64 processor 4K in size. (Pages can actually be larger in some cases, but let's leave out that complexity right now.) The operating system builds page tables which translate virtual addresses into physical addresses. The processor fetches these page table entries as it executes code so that the software can operate using just virtual addresses.

The virtual addresses are the same as the physical address, for the lower 12 bits of the address, since 4K is 2 to the 12th power.

In an x86 processor with PAE mode turned on, the physical address size is 36 bits. (This was later extended a little bit, and it can be 37 or 38 bits on some machines.) If you subtract the 12 bits that are not specified in the page table entry (because they are the same in the virtual and physical addresses) you are left with 24 bits. Those upper 24 bits of physical address in the page table entry replace the upper bits of the virtual address to make the actual physical address used by the processor.

Note that the virtual address don't have 36 bits. It only has 32 bits. So those upper 24 bits replace the upper 20 bits of virtual address. This points out that, while PAE mode allows the machine to have more than 4GB of memory (4GB is 2 to the 32nd power) no single process can have more than 4GB of virtual memory.

share|improve this answer
add comment

Perhaps this is referring to physical page numbers? With a 36 bit physical address bus, which is I think the maximum for a 32-bit x86 processor, and 4K pages, you'd need 24 bits to uniquely identify each physical page.

share|improve this answer
add comment
#include <stdio.h>

int main() {
    int total = 5;
    int *ptr = &total; /*Set ptr to the address of total*/

    printf("%d",ptr);

    return 0;
}

Output: 2293620

Which is 0x22FF74, and that's 24 bits.

Of course, I'm still hopelessly ignorant when it comes to Windows' memory, so I don't know what that means. :D

share|improve this answer
1  
That just means that the highest bit set is bit 23; that doesn't mean there aren't 8 more bits usable in the pointer. It makes some sense that the C library starts at addresses lower down the address space and works up (except for stacks) –  MarkR Oct 14 '09 at 7:18
add comment

The author should really kill himself against a wall. "represents physical addresses internally with 24 bits" means that there're only 16Mb available for addressing, so it would have been the maximum RAM available :)))

The quote says nothing 'bout page addressing (like Stephen Veiss said), so this is not true.

share|improve this answer
    
That'd be 16MB, not 16KB. The i286 had a 24 bit physical address bus... –  Brian Knoblauch Oct 2 '09 at 12:59
    
Yep, sure! :) Just a mistake... –  kolypto Oct 2 '09 at 23:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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