In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Memory governance (Memory Management) is one of the most important and complex aspects of operational piecemeal design. Although the computer hardware is constantly developing rapidly, and the memory capacity is also increasing from time to time, it is still possible to put all the programs and data required by all user processes and bits and pieces into the main memory. so the operation must stop the reasonable division of memory space and invalid earthquake state allocation. Operating piecemeal partition and static allocation of memory is the concept of memory governance.
Invalid memory governance is very important in multiprogramming, which not only facilitates users to use memory and improve memory application rate, but also logically expands memory through virtual techniques.
The functions of memory governance are:
The allocation and reception of memory space: the allocation and management of main memory space are completed piecemeal by operation, which frees programmers from the trouble of memory allocation and improves the effectiveness of programming.
Address translation: in the case of multi-programming, the logical address in the program is different from the physical address in memory, so storage management must provide address conversion function to convert logical address into physical address of response.
Expansion of memory space: apply virtual storage techniques or active masking techniques to logically expand memory.
Storage maintenance: make sure that each homework runs in its own storage space. Don't disturb each other.
Before stopping detailed memory governance, you need to understand the rationale and requirements for the operation of the process.
Program loading and linking
The first step in the creation process is to load programs and data into memory. To change a user's source program into a program that can be executed in memory, the following steps are required:
Compilation: the compiler compiles the user's source code into several target modules.
Linking: a set of compiled target modules and required library functions are linked together by the linker to form an intact loading module.
Load: the loading module is loaded into memory by the loader.
These three-step processes are shown in figure 3-1.
Figure 3-1 the pace of disposal of user programs
There are three ways to link a program:
Static linking: before the program runs, link the various modules and their required library functions into a good executable program, which will not be taken apart in the future.
Static linking at load time: a set of destination modules that are lost after the user's source program is compiled, using the link method of loading links while loading into memory.
Run-time static link: a link to a certain destination module that stops when the destination module is needed in the execution of the program. Its advantage is that it is easy to modify and update, and it is easy to complete the sharing of the target module.
When loading a memory module, there are three ways to load it:
1) relative loading. At compile time, if you know that the program will reside in a certain position in memory, the compiler will produce the destination code of the relative address. The relative loader loads the program and data into memory according to the address in the load module. Because the logical address in the program is completely opposite to the actual memory address, there is no need to stop correcting the address of the program and data.
The relative loading method is only applicable to the case of a single program. In addition, the relative address used in the program can be given at the time of compilation or assembly, or directly given by the programmer. On the other hand, symbolic addresses are used in programs on weekdays, and then converted to relative addresses when compiled or compiled.
2) relocatable loading. In the case of multi-programming, the original address of multiple destination modules usually starts from 0, and most of the other addresses in the program are absolutely for the original address, so the relocatable loading method should be used at this time. According to the future state of the memory, load the module into the appropriate position of the memory. The process of correcting instructions and data in the destination program during loading is called relocation, and address conversion is usually completed at one time during loading, so it is also called static relocation, as shown in figure 3-2 (a).
Figure 3-2 redirection type
The characteristic of static relocation is that when a homework is loaded into memory, all the requested memory space must be allocated. If there is not enough memory, the homework cannot be loaded. In addition, once the homework enters the memory, it cannot be moved in the memory or request the memory space during the whole running period.
3) static operation of ancient loading, also known as static relocation, if the program moves in memory, it is required to use a static loading method. After loading the loading module into memory, the loader does not immediately convert the absolute address of the loaded module into a relative address, but delays this address translation until the program is really about to perform. Therefore, all addresses after loading into memory are absolute addresses. This approach requires the support of a relocation repository, as shown in figure 3-2 (b).
The characteristic of static relocation is that the program can be assigned to a discontinuous storage area; it can be put into operation by loading only its local code before the program is running, and then the memory can be allocated according to the static request during the running of the program; to facilitate the sharing of program segments, users can be provided with an address space that is much larger than the storage space.
Logical address space and physical address space
After compilation, each destination module is mostly addressed from unit 0, which is called the absolute address (or logical address) of the destination module. When the link program links each module into an intact executable program, the link program sequentially forms a consistent logical address space addressing from unit 0 according to the absolute address of each module. User programs and programmers only need to know the logical address, while the detailed mechanisms of memory governance are fully understood and can only be touched by piecemeal programmers. The bifurcation process can have opposite logical addresses, because these opposite logical addresses can be mapped to the bifurcation status of main memory.
Physical address space refers to the aggregation of physical units in memory, which is the final address of address translation. During operation, instructions and visit data are initially accessed from main memory through the physical address. When the loader loads the executable code into memory, the logical address must be converted into a physical address through address translation, a process called address relocation.
Memory maintenance
Before memory allocation, the requirements maintenance operation is not affected by the user process, while the maintenance user process is not affected by other user processes. This maintenance is accomplished by using the relocation memory and the boundary address register. The relocation memory contains the lowest physical address value, and the boundary address memory contains the logical address value. Each logical address value must be smaller than the boundary address memory; the memory governance institution statically compares the logical address with the boundary address memory, and if the address is not out of bounds, it will be mapped to a physical address after adding the value of the relocation memory, and then sent to the memory unit, as shown in figure 3-3.
When the CPU modulator selection process is performed, the dispatcher initializes the relocation store and the boundary address holder. Each logical address needs to be checked with the two registers to ensure that the operation is piecemeal and that other user programs and data are not affected by the operation of the process.
Figure 3-3 hardware support for relocation and boundary address 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.
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.