mmu vs. non-mmu processors

jhu

Lifer
Oct 10, 1999
11,918
9
81
so what's the difference between the two? what does an mmu do for you that a lot embedded processors leave out?
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Virtual memory support (support for virtual addresses so that every process sees itself as having the whole address space, memory protection so processes can't see/change each other's memory, and so on).
 

arcas

Platinum Member
Apr 10, 2001
2,155
2
0
One of the incredibly useful things an MMU lets you do is make a bunch of discontiguous chunks of memory appear to be contiguous. So, instead of trying to find, say, 64 contiguous 4KB pages of free memory, you could allocate 64 discontiguous pages and let the MMU "massage" them so they appear to be contiguous. For example, the Linux kernel routine vmalloc() does this. I'm sure other operating systems have similar routines.

In general though, embedded applications are highly specialized and don't need things like memory protection or virtual memory so there's no need to waste power or die size on a MMU that's not going to be used.

 

rjain

Golden Member
May 1, 2003
1,475
0
0
The MMU basically allows the OS to define how to map the memory addresses in the registers to memory locations on the memory bus. All the other features described above are gained by using this simple feature.

Specifically, the memory space is divided into 'pages' of some size (sometimes configurable by the OS). A common page size is 4-16KB. When memory is accessed, the MMU takes the memory address, strips off the bits corresponding to the page size, and the remainder is the virtual page number. The MMU then looks in the page table assigned by the OS to see where this virtual page number maps to in terms of physical page numbers. This value is sent, along with the offset that was stripped off earlier, down the memory address lines of the CPU. The page table entry also has info such as whether reading or writing or both is allowed on that page.

In order to protect one process's memory from another's, OSes will use separate page tables for each process, with none of them sharing any pages.
 

rjain

Golden Member
May 1, 2003
1,475
0
0
The MMU basically allows the OS to define how to map the memory addresses in the registers to memory locations on the memory bus. All the other features described above are gained by using this simple feature. Specifically, the memory space is divided into 'pages' of some size (sometimes configurable by the OS). A common page size is 4-16KB. When memory is accessed, the MMU takes the memory address, strips off the bits corresponding to the page size, and the remainder is the virtual page number. The MMU then looks in the page table assigned by the OS to see where this virtual page number maps to in terms of physical page numbers. This value is sent, along with the offset that was stripped off earlier, down the memory address lines of the CPU. The page table entry also has info such as whether reading or writing or both is allowed on that page.