What is the MMU of a microcomputer?

The memory management unit (MMU) is your working part, responsible for managing memory read/write.

In one sentence, the "memory management component" is the "memory management unit". It is also possible to omit the memory management unit and express it as "MMU".

For example, memory is "a desk used when working on a computer." Mr. Computer spread his work tools on the table (memory) and worked diligently.

Mr. Computer puts things on this table as needed. Or, take something from the table.

In fact, Mr. Computer is not good at organizing. If you use it as you like, the table will be messy and become very powerful.

This situation is terrible. Mr. Computer who thought this way hired someone to manage the desk.

From then on, Mr. Computer wouldn't touch the desk by himself. When you want to put an orange on the table, you will give the administrator of the table the instruction "this orange, put it on the table".

The reverse is also true. When I want to eat oranges, I don’t touch the table. Instructed the administrator of the table: "Bring the oranges on the table."

In this way, Mr. Computer doesn't need to do the sorting that he is not good at. For the administrator on the table, it will handle it well.

In this story, the administrator of the table is the memory management unit.

Next, let's explain with the conversion of physical address and logical address.

The table (memory) used by the computer is separated by a grid from above. Moreover, each grid is assigned a number for ease of use.

This "number assigned to the grid" is called the "address".

For example, suppose you put oranges on number 13. It means that oranges were placed at address 13.

Then, the number on the grid of this table is different for the following two aspects.

  • Actual assigned number (physical address)
  • The number when viewed from the program (logical address)

The program said: "I put the orange at the first address!" I thought, it was actually at address 100.

For another example, here is a program with oranges. Mr. Program wants to put oranges on the table.

At this time, Mr. Program will not put oranges directly on the table. I asked the memory management unit to "put this orange on the table".

Mr. Program entrusted the memory management unit to say: "Put this orange at address 1."

Mr. Memory Management Unit who accepted this commission used orange as address No. 1... but not necessarily. It is decided without authorization according to the mood of the memory management unit. Oops, it seems that I put the orange at address 13 this time.

After a while, Mr. Program came back. Mr. Procedure seems to be hungry. He entrusted the memory management unit and said: "Bring the orange that I put on address 1."

Mr. Memory Management Unit, who received this request, casually brought oranges from address No. 13. Then said to him: "Well, this is the orange at address 1."

Here, please pay attention to the number of squares where oranges are placed.

Mr. Procedure originally planned to put oranges in the square of "Number One". From the point of view of Mr. Program, although Mr. Memory Management Unit has passed, it is also taken out of the oranges placed in the first grid.

Actually, Mr. Memory Management Unit's hand was placed in the square of "No. 13".

From Mr. Program's point of view, the grid number is called "logical address".

The square number actually assigned to the table is the "physical address".

This situation can be said to be in the hands of the memory management unit, where the logical address and physical address are converted. This is one of the tasks of the memory management unit.

At last

If the word "memory management unit" appears, think about it: "This is the part that manages all aspects of memory~".

Guess you like

Origin blog.csdn.net/qq_18191333/article/details/107521052