Does the MMU mediate everything between the operating system and physical memory or is it just an address translator?

前端 未结 2 2039
既然无缘
既然无缘 2021-01-31 12:53

I\'m trying to understand how does an operating system work when we want to assign some value to a particular virtual memory address.

My first question concerns whether

2条回答
  •  無奈伤痛
    2021-01-31 13:26

    There are data structures that describe which virtual addresses correspond to which physical addresses. The OS creates and manages these data structures, and the CPU uses them to translate virtual addresses into physical addresses.

    For example, the OS might use these data structures to say "virtual addresses in the range from 0x00000000 to 0x00000FFF correspond to physical addresses 0x12340000 to 0x12340FFFF"; and if software tries to read 4 bytes from the virtual address 0x00000468 then the CPU will actually read 4 bytes from the physical address 0x12340468.

    Typically everything is effected by the virtual->physical translation (except for when the CPU is accessing the data structures that describe the translation). Also, usually there's some sort of translation cache build into the CPU to help reduce the overhead involved.

提交回复
热议问题