In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Today we take a look at the embedded memory management unit (MMU), which is a functional unit for modern processors to manage memory efficiently. The operating system can use the memory management unit to achieve virtual memory and memory protection. Let's start with an interesting question: is the output of the following program exactly the same after running twice? Why?
Let's analyze it first. In theory, different processes execute at different locations in memory; therefore, the addresses of global variables are different. The relationship is as follows
Let's see the results.
We see that the address of the result of the two runs is the same, which means that our previous analysis is wrong. We are often forgotten in the development of the facts: 1, application development, the face of the memory is virtual memory; 2, the memory address used in the virtual memory mode is virtual address; 3, each process has an independent private virtual address space. In other words, virtual memory is independent of actual physical memory, it is a hypothetical large enough memory. So let's think about whether an application with a total memory requirement of 1G can run on a computer with 256m of hardware memory. It is definitely supported in modern times, through virtual memory. The meaning of virtual memory is to support multiple processes with large memory requirements to run in smaller physical memory at the same time, as follows
For example. When we were in primary school, the teacher moved the handouts and books to the blackboard for explanation. At the beginning, there was nothing on the blackboard, there was a lot of space, and the teacher could write at will. But with the passage of time, in the second half of the section, the blackboard is full of content. If the teacher wants to keep writing, he has to erase some of what has already been written in order to write something new. Let's take a look at the mechanism of virtual memory: a > virtual memory needs to be remapped to physical memory; b > virtual addresses are mapped to real addresses in physical memory; c > only a small amount of code for processes runs in physical memory at a time; d > most of the process code is in memory. In virtual memory management, it is managed as page memory. A unit of page memory that refers to a certain amount of memory (such as 4K); virtual memory and physical memory are managed on a page-by-page basis; the mapping of addresses is recorded when the active page of a process is loaded into memory. The relationship is as follows
The page-based memory management method divides the memory into two parts: (pmemory d). P refers to the high order of the address, page number; d refers to the low bit of the address, the offset on the page. As follows
We map physical addresses and virtual addresses through the page mapping table. The details are as follows
It is to carry on the MMU, first carries on the search, then carries on the corresponding mapping to the virtual memory display according to the corresponding relation found. What if no corresponding relationship is found? Let's look at the specific process, as follows
If not, swap out the idle pages from physical memory, update the page mapping table and insert them into physical memory. Finally, the address is mapped to physical memory for display. So let's think about why these ways can improve computer performance. 1, replace the processor with higher main frequency (same series); 2, increase the physical memory size; 3, replace the SSD solid state disk. In the first case, a higher processor means that the processing speed is faster, so the computer performance is improved. In the second case, the larger the physical memory, it means that there is no need to replace the page, so the efficiency is naturally improved. Third, replace the SSD solid state drive, the processing speed in memory will be faster, so the efficiency will be higher.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.