What’s difference between MMU and MPU?
Literally speaking, MMU is ‘Memory Management Unit’ while MPU is ‘Memory Protection Unit’. Both of these are specialized hardware that is used by CPU for memory handling. MMU is used for many functions primarily Virtual Memory (i.e. translation of virtual address to physical address) and memory protection. But MPU is used for memory protection only. In that sense, we can think of MMU as a superset of MPU.
Processors which need to run high-end operating systems such as Android, Linux, and Windows typically have MMU but processors which need to run RTOS such as ThreadX, and Nucleus typically have MPU. Let us mention a few of the real-world examples of processors with MMU and MPU. Typically, a smartphone contains two main processors – one which runs high-end OS (e.g. Android) where Apps are running and the second which runs baseband RTOS (e.g. ThredX) where 3G/4G protocol stacks are running. The first one is called an Apps processor while the second one is called a Baseband processor. Apps processor (e.g. ARM Cortex-A series) has MMU while Baseband processor (e.g. ARM Cortex-R series) has MPU.
A quick analogy can be thought of MMU as ‘swiss army knife’ and MPU as ‘knife’! Basically, MMU implementation in HW is much more complex than that of MPU. That’s why many computer systems (such as real-time embedded systems) which don’t need Virtual Memory but need memory protection have much simpler MPU instead of full-blown MMU.
Let us see the Differences in a Tabular Form:
|1.||MMU stands for “Memory Management Unit“||MPU stands for “Memory Protection Unit”|
|2.||It is used to handle the memory and manage it.||It is used to Protect the memory|
|3.||Its benefit is that it prevents our device from software bugs which can be caused by anything like page fault||It is implemented in low-power processors in most computers.|
|4.||In Memory, Table MMU is known as Page Table||It updates the transactions like instruction fetches and data accesses from the processor in our computer.|
|5.||Its functionality is it performs application memory management.||It is used to prevent a process from accessing memory which is not allocated to it which helps our computer to be prevented from kind of bugs.|
|6.||It is a Hardware unit in the CPU||It is also a hardware Unit in the CPU|