Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Deep and simple processor (part two) _ memory Management (Mapping)

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Topic 1-Deep and simple processor processor (part two) _ memory Management (Mapping) 1. Memory management unit (MMU)

The memory management unit is referred to as MMU, which is responsible for the mapping of virtual address to physical address and provides memory access permission check of hardware mechanism. MMU enables each user process to have its own independent address space and protects the memory used by each process from being destroyed by other processes by checking memory access permissions. The operating system memory management unit realizes virtual memory and memory protection.

The key point is address mapping: the structure of the page table and the process of establishing and mapping.

two。 Question: is the output of the following program exactly the same? Int int main (void) {printf ("Grouv =% d\ n", Grunv); printf ("& Grunv =% p\ n", & Grunv); Pause (1); return 0;}

According to normal logic analysis, theoretically, different processes execute in different locations in memory, so the addresses of global variables are different.

Experimental results:

The address after running is the same, which is different from what we expected, because the addresses we use based on the operating system are virtual addresses.

Often by the facts of the past:

When developing an application, the memory faced is virtual memory, the memory used in virtual memory mode is virtual address, and each process has its own independent virtual address space. Virtual memory is independent of actual physical memory, so it is a hypothetical large enough memory space.

Therefore, applications with a memory requirement of 1G can also run on a computer with an actual memory of 256m.

3.3 the meaning of virtual memory

The significance of virtual memory is that it can support multiple processes with memory requirements to run in smaller physical memory at the same time.

4 the mechanism of virtual memory

a. Virtual memory needs to be remapped to physical memory.

b. The virtual address is mapped to the actual address in physical memory.

c. Only a small amount of code from the process runs in physical memory at a time

d. Most of the process code is in the storage area

3.5 Page memory management

A page is a unit of memory, which refers to a certain amount of memory, usually 4K in a page.

Virtual memory management and physical memory management are managed in pages

Record the mapping of the page address when the process's active page is loaded into memory

Page memory management is divided into two parts: (p, d)

P refers to the high address, page number.

D refers to address status, intra-page offset

3.6How to improve computer performance, why?

a. Replace the processor with higher main frequency (same series): when the main frequency is higher, the query speed and swap speed in the above process will be improved, which naturally increases the reading and writing speed of the computer, thus improving the new energy.

b. Increase physical memory size: increasing physical memory reduces the number of swaps in and out of the above processes.

c. Replace the SSD solid state drive: increases the speed of reading and writing memory.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report