I know there are those 2 types of memory virtual and physical, and MMU mapping between them, but WHAT I can't understand is WHERE are stored those virtual addresses if they are "virtual". Admitting I have 1 process and he has something to read at his virtual address 0x00000004 then the MMU is going to map this virtual address to 0xSomeWhere in the real physical address. What I want to know is WHERE is this information stored --> 0x00000004 <-- because somewhere there MUST be those bits 00000000000000000000000000000100.
Admitting I have another similar process and he also has an instruction to read at his virtual address 0x00000004, where is this one? How are separated the 2 processes?
Just like array indexes, virtual addresses are usually1 not stored anywhere; they're implicit. The virtual address is used as a index into the page table to look up the physical address.
1It actually depends on the MMU implementation. Some, such the a PowerPC/Power architecture use a hashing scheme that does involve actually storing virtual addresses in the page table instead of physical addresses
The virtual addresses are just the addresses in the program image and the CPU registers. User code running on a machine with an MMU doesn't care about the VA-PA mapping, it just has what it believes to be it's own address space. So the PC contains a virtual address, the stack pointer is to a virtual address, etc.
In some sense, it is the PA which is more abstract to the machine. PA is some arbitrary external location, which only the kernel software knows/cares about. (There are other tasks of the mmu, but this covers your question)
User contributions licensed under CC BY-SA 3.0