Question

The MMU is used to translate virtual address to physical address for a running process with the help of page table corresponding to that process. Lets take a scenario when the virtual address space is equal to physical address space. Do we really require MMU in that case as we won't we having a situation where same virtual address space maps to different physical addresses?

Lets say

Virtual Address              
| 20 bits (V) | 12 bits(PO) |

Physical Address 
| 20 bits(PPN) | 12 bits(PO) |

where V = Virtual Page
      PO = Page offset
      PPN = Physical Page Number

Do we really require Page Table for every process? What problems might appear when there are more than one process?

Please neglect cache memory for simplification.

Était-ce utile?

La solution

The MMU does much more than mapping a virtual address space to a physical address space of different size. The most important point of an MMU is memory protection, which is relevant even if both address spaces have the same size:
The MMU handles pages (e.g. 4 kB of size) of virtual memory that are mapped to pages of physical memory.

In most systems, there is not only a single virtual address space, but one for every process. Under MMU control, every process can only access pages as allowed by the operating system (which programs the MMU). Most pages of different processes are isolated from each other, so that e.g. one process cannot crash another process by writing into its memory.

Mapping of virtual to physical pages under OS control allows address space randomization, so that reading across a virtual page boundary results in reading random data instead of certain data (a protection against e.g. buffer overflow attacks).

Moreover, even if there is a single process, pages can be treated as read-write, read-only, execute only, and access forbidden. This allows to restrict a process to access its own pages in a permitted way, e.g. it can make it impossible to execute "data" stored.
Some more information can be found here.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top