42_KFS/documentation/memory/mmu.md

878 B

Memory Management Unit (MMU)

The MMU is a chip which translate virtual memory to physical memory. When you try to access to an address (/!\ only when you try to access) the MMU will get the physical address from the pd.

How translate an address ?

The address will be divid in 3 parts:

  • Page Directory index (10bit (cause 1024))
  • Page Table index (10bit (cause 1024 too))
  • offset (12bit cause page size = 4096)

Example

address: 0b000100000011101011111011101101

Base PD index PT index offset
Binary 00010000 0011101011 111011101101
Decimal 16 235 3821

So to translate this address the MMU will get the 20 first bit of the value store at the 235th PTE of the 16th PDE and will replace the 20 first bit of the virtually address.