{"id":9370,"date":"2020-08-10T10:16:14","date_gmt":"2020-08-10T09:16:14","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=9370"},"modified":"2026-03-26T17:00:31","modified_gmt":"2026-03-26T21:00:31","slug":"memory-management-units","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/embedded-software\/2020\/08\/10\/memory-management-units\/","title":{"rendered":"Memory Management Units"},"content":{"rendered":"<p>It is curious to consider some technology that, to many engineers, is rather mysterious, whilst, to others, is indispensable. The same technology is conceptually simple, but may be incredibly complex in its implementation. I am thinking about a Memory Management Unit [MMU] \u2026<!--more--><\/p>\n<p>During its operation a CPU generates a sequence of addresses, along with a a read\/write signal, indicating the memory location or peripheral device register that it wishes to access. An MMU\u2019s job is to take the address asserted by the CPU and translate [map] it to an alternative address. This permits a separation of \u201cvirtual addresses\u201d [used by the software on the CPU] and \u201cphysical addresses\u201d [used by the memory and peripheral hardware.<\/p>\n<p>Obvious question: why is this remapping desirable, useful or necessary?<\/p>\n<p>The most common use of an MMU is to facilitate deployment of a \u201cprocess model\u201d operating system, like Linux. In this case, each task has one or more dedicated areas of memory for its code and data. When a task is made current by the scheduler, the MMU maps these physical addresses onto a logical address area starting from 0. All the physical memory belonging to other tasks [processes] and to the OS itself is hidden from view and, thus, protected. Each process behaves as if it has free use of the entire CPU. Although this mechanism is safe and elegant, it has the drawback that there is an overhead \u2013 the MMU remapping \u2013 on every context switch. It follows that having an MMU is essential if Linux is to be used.<\/p>\n<p>Another way to use an MMU is to implement \u201cthread protected mode\u201d or \u201clightweight process model&#8221;. In most RTOSes, an MMU has not been traditionally used and all memory is visible at all times. If the MMU is set up appropriately, parts of the mapping may be switched off as each task is scheduled. Thus, no remapping of addresses occurs, but only the memory for the current task, and relevant parts of the OS, is visible at any one time. This provides much of the protection of process model, with a lower overhead on each context switch. This capability is only available with certain RTOS products, such as <a href=\"https:\/\/www.mentor.com\/embedded-software\/nucleus\/\" target=\"_blank\" rel=\"noopener noreferrer\">Nucleus<\/a>.<\/p>\n<p><a href=\"http:\/\/www.linkedin.com\/in\/colinwalls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6579\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/linkedin.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/twitter.com\/colin_walls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6583\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/twitter.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/www.facebook.com\/colinwalls.author\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6591\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/facebook.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"http:\/\/blogs.mentor.com\/colinwalls\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6599\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/wordpress.jpg\" alt=\"\" width=\"44\" height=\"44\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is curious to consider some technology that, to many engineers, is rather mysterious, whilst, to others, is indispensable. The&#8230;<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[300,307,336,337,304,374,378,611,309],"industry":[],"product":[],"coauthors":[],"class_list":["post-9370","post","type-post","status-publish","format-standard","hentry","category-news","tag-embedded-software","tag-linux","tag-memory-management-unit","tag-mmu","tag-nucleus","tag-nucleus-os","tag-nucleus-rtos","tag-process-model","tag-rtos"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/9370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=9370"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/9370\/revisions"}],"predecessor-version":[{"id":10915,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/9370\/revisions\/10915"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=9370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=9370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=9370"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=9370"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=9370"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=9370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}