Read operating system concepts for continuous memory allocation version 6

Source: Internet
Author: User

Memory is usually divided into two areas: one for resident operating system and the other for user processes.

The operating system is not affected by user processes, and the user processes are not affected by other user processes. This protection can be achieved through the adoption of relocation registers and limit registers. The relocation register contains the minimum physical address value, and the limit register contains the logical address value. With the relocation register and limit register, each logical address must be smaller than the limit register; MMU dynamically maps the logical address with the value of the relocation register to the physical address. The mapped physical address is sent to the memory unit.

When the CPU scheduler selects to execute a process, as part of context switching, the dispatch program initializes the relocation register and limit register with the correct value.

 

Memory fragments can be internal or external. Suppose there is a hole of 18464b size and a multi-partition allocation scheme is adopted. Assume that a process requires 18462b. If the required block is allocated accurately, A 2b hole is left. The cost of maintaining this small hole is much larger than that of the hole itself. Therefore, memory is usually allocated in a fixed block size. Using this scheme, the memory allocated by the process may be larger than the required memory. The difference between the two numbers is called internal fragmentation, which exists in the partition and cannot be used.

One way to solve external fragmentation problems is to tighten. The purpose of compression is to move the memory content so that all idle space can be merged into a whole block. There are certain conditions for tightening. If relocation is static and is performed during assembly or loading, it cannot be tightened. If the relocation is dynamic and it is performed during motion, the tightening can be adopted. For dynamic relocation, You can first move the program and data, and then change the base address register based on the value of the new base address. If you can adopt tightening, you also need to evaluate the overhead. You also need to evaluate the overhead. The simplest merge algorithm is to simply move all processes to one end of the memory, and move all the holes to the other end of the memory to generate a large idle block.

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.