Process load evolutionary history and virtual memory

Source: Internet
Author: User
Tags advantage

The essence of the program loading is to load the executable into memory for CPU calls to execute.

Original load:

In an earlier computer, the program ran directly on physical memory, and the address that the program accessed at run time was the physical address.

Suppose we calculate 128MB memory, program a needs 10MB, program B needs 100MB, program C needs 20MB. If we need to run programs A and b at the same time, the more straightforward approach is to assign the first 10MB of memory to the program A,10MB~110MB assigned to B.
But in doing so, the address space is not isolated, memory usage is inefficient, and the program is running at an indeterminate address.

The original load is to load the executable file into memory to complete the process task.

Problems with the original load:

1) The address of the program is not starting from 0, it is contrary to people's thinking habits.

2) Insufficient memory.

First time Evolution: Dynamic Loading

Used to troubleshoot low memory issues.

The instructions and data required to execute the program must be in memory to function properly. Of course, the simplest way is to load all the resources needed to run the program into memory. But this can cause a waste of memory. The research finds that the program runs with local principle, so the better solution is to keep the most common parts of the program in memory, and store some less common data on disk, which is the basic principle of dynamic loading .

Overlay Loading (Overlay) and page mapping (Paging) are two typical dynamic loading methods that take advantage of the program's locality principle. The basic idea of dynamic loading is which module is used to load which module into memory, and if not, it is temporarily not mounted and stored to disk.

Overwrite loading

The overlay loading method gives the programmer the ability to exploit the memory potential, which must be manually split into chunks at the time of writing, and then write a small helper code to manage when the modules should reside in memory and when they should be replaced. This small helper code is called the overlay Manager (Overlay Manager).
Programmers need to manually organize modules into tree-like structures according to their invocation dependencies. Overwrite the manager to ensure that a module is called when the entire call path is in memory

page Mappings (Paging)

A page map is a page that divides the data and instructions in memory and all disks into pages, and all the units that are loaded and manipulated in the future are pages. The swap-in mechanism (such as fifo,lur, etc.) can be completed.

Second Evolution:

Security and sharing control

http://blog.csdn.net/cc_net/article/details/24726287

paging is actually a purely logical concept, because the actual program and memory are not really broken down into different pages. And the segmentation is different, he is a logical entity. A segment can be a variable, a source code, or a stack. In general, different types of content are not included in each segment. And the segment has the following functions mainly:

    1. solve the compilation problem : The problem of address overwrite at compile time is mentioned earlier, which can be solved by segmentation, thus simplifying the compiling program.
    2. recompile: Because different types of data are in different segments, but one of the segments is modified, you do not need to recompile all the segments.
    3. Memory Sharing : Segmentation of memory, it is easy to share the code snippets or data segments to other programs, paging because the data code is mixed in a page, so it is not easy to share.
    4. security : After dividing the memory into different segments, because different segments have different content types, they can do things differently, such as when the contents of a code snippet are loaded and should not be allowed to write operations, because this alters the behavior of the program. In a paging system, because a page is not a logical entity, the code and data may be mixed together and cannot be safely controlled.
    5. dynamic linking : A dynamic link means that several target segments are not linked before the job runs. To run, the target program that corresponds to the main program is loaded into memory and started to run, and the segment (the target program) is called into memory and linked when it needs to call a segment during the run. Visible, dynamic linking also requires segments as the administrative unit.
    6. Maintain compatibility

Therefore, segmented memory management is required in today's x86 architecture, and paging management is optional.

Disadvantage: The process must all be loaded into memory.

Third Evolution: section-page management and virtual memory

Section-Page Memory management

http://blog.csdn.net/cc_net/article/details/24726287

The advantage of segmented memory management is memory sharing and security control, and the advantage of paging memory management is to improve internal utilization. They are not competing against each other, but can complement one another. That is, you can combine 2 ways, that is, the most commonly used in the computer section of the page-based memory management . The core of section-page management is to fragment the memory, paging through each segment. This makes it possible to use the physical pages of memory more rationally while having the advantage of fragmentation.

Process load evolutionary history and virtual memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.