Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There are only 36 physical address lines but a page table entry is 64 bit long. How does the CPU check if the address is valid ? How does Linux OS map the same virtual address in different processes to different physical addresses?

Here is the wikipedia article about physical address extension(PAE). http://en.wikipedia.org/wiki/Physical_Address_Extension .

share|improve this question

migrated from stackoverflow.com Mar 5 '13 at 12:33

This question came from our site for professional and enthusiast programmers.

    
By adding different offsets to them, perhaps? –  H2CO3 Mar 1 '13 at 16:08
2  
PT entries are 64-bit because they can only be 32 or 64 bits wide. There is no such thing as a 36-bit integer that a CPU can usually access (not any real CPU anyway, without shifting and masking). It doesn't matter, however. The OS will write 64-bit-sized 36-bit integers into the PT, and the application uses 32-bit integers as pointers which the PT translates to whatever the respective entries point to. Including several virtual addresses pointing to the same phyical one. Nobody cares, the hardware just maps what you tell it to what you tell it. –  Damon Mar 1 '13 at 16:11

1 Answer 1

There are only 36 physical address lines but a page table entry is 64 bit long. How does the CPU check if the address is valid?

This is actually done by a piece of hardware called the memory management unit (MMU), which handles virtual-to-physical address translation. In terms of an address being "valid", each process has it's own unique address space (thus implementing a virtual memory scheme), so any address is technically valid. Remember, a process can allocate more memory than is physically available.

The MMU uses a translation lookaside buffer (TLB) to quickly decode the virtual address into a physical one, held within a page table.

How does Linux OS map the same virtual address in different processes to different physical addresses?

This is again due to each process having a unique virtual address space, which is fundamental for implementing virtual memory. A virtual address for a given process is mapped to some physical storage hardware (RAM, disk, etc...), but the mapping is done at run-time by the operating system & MMU.

share|improve this answer

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.