Request memory allocation on the page and request paging Memory Allocation

Source: Internet
Author: User

Request memory allocation on the page and request paging Memory Allocation

When allocating memory to a process, three problems are involved: first, to ensure that the process can run normally, the minimum physical speed required is determined; second, when allocating physical blocks to each process, what allocation policies should be adopted, that is, whether the allocated physical blocks are fixed or variable? Third, whether the number of physical blocks allocated to different processes is based on the average allocation algorithm or proportional distribution based on the process size.

First, we will introduce several concepts:

The so-called fixed allocation refers to the allocation of a fixed number of physical blocks for each process, which will not change during the process running.

The so-called local replacement means that if a process finds a page missing during running, it can only select one page from the n pages allocated to the process for replacement, and then call it to the next page, to ensure that the memory space allocated to the process remains unchanged.

Variable Allocation means that a certain number of physical blocks are allocated to each process first. During the process running, the number of physical blocks can be increased or decreased as appropriate.

Global replacement means that if a process finds a page missing during its operation, it will take out the idle physical block reserved by the OS (usually organized as an idle physical block Queue) and assign it to the process, or, use all the physical blocks of all processes as the benchmark, select a swap-out, and then call the missing page. In this way, the memory space allocated to the process increases accordingly.

Here, I will leave aside the first and third questions. Let's focus on the second memory allocation policy.

In the request paging system, two memory allocation policies can be adopted: fixed and variable allocation policies. During replacement, you can also adopt two strategies: Global replacement and local replacement. Therefore, the following three applicable strategies can be combined (which is why I want to write this article ).

1) Fixed Allocation Local Replacement (Fixed Allocation, Local Replacement)

When this policy is adopted, the number of physical blocks allocated to each process is determined based on the process type (batch or batch processing type) or the suggestions of programmers and program administrators.

The difficulty in implementing this policy is that it is difficult to determine how many physical blocks should be allocated to each process. If there are too few pages, the middle section is frequently displayed, reducing the system throughput. Too many processes will inevitably reduce the number of processes that reside in the memory, which may lead to idle CPU or other resources, and it will take more time to implement process switching.

2) Variable Allocation, Global Replacement)

Variable Allocation global replacement is probably the easiest way to implement a physical block allocation and replacement policy, which has been used in several operating systems. When this policy is adopted, all processes that generate page-missing (interrupted) will obtain new physical blocks. Only when the physical blocks in the idle physical block queue are used up, OS can be selected from memory for one page. The selected page may be a page in any process in the system. Therefore, the physical block of the selected process is reduced, resulting in an increase in the page missing rate.

3) Variable Allocation, Local Replacement)

This policy is also based on the process type or assigns a certain number of physical blocks to each process according to the programmer's requirements. However, when a process discovers a page missing, you can only select a page for output from the memory page of the process, so that the operation of other processes is not affected. If a process is frequently interrupted due to page defects, the system allocates several additional physical blocks for the process until the process's page missing rate is reduced to an appropriate level. If a process has a low page missing rate during running, you can appropriately reduce the number of physical blocks allocated to the process, but it should not cause a significant increase in the page missing rate.

Here, you may find that there are only three Allocation and Replacement policies, and there should be four types of logic. Is there a difference between Fixed Allocation and Global Replacement )?

I also thought about why there is no fourth match. I am also searching for the answer. I hope I can find the answer!

Related Article

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.