What is relocation? __ Storage

Source: Internet
Author: User

6. 1 Basic concepts of memory

Main memory management is still a very important content of today's operating system, whether reasonable and effective use of main memory, in a large degree to reflect the performance of the operating system, and directly affect the entire computer system to play a role.

level of 6.1.1 memory

At present, in many computer systems, three-class memory structure is used, namely, high speed buffer memory, main memory and external memory.

Comparison of level three memory

From the cache to the external memory, its capacity is increasing, the general difference between several orders of magnitude. The speed of access to data is slower, and prices are getting cheaper.

6.1.2 Address Relocation

To figure out what relocation is, we first introduce the concept of relative address, absolute address and logical address space, and storage space.

1. Logical address space

name Space

When a user is programming or editing a source program, it does not take into account the allocation of storage space between jobs, but instead saves its source program in the symbolic namespace (name space) established by the programmer, as shown in Figure 6-1 (a).

Logical address Space

When compiling a source program, the address range that is qualified by the compiled target program is called the logical address space for the job.

Figure 6-1 name space, address space, and storage space

As shown in Figure 6-1 (b).

2. Physical Space

The so-called physical space (also known as storage space) refers to the collection of physical units in main memory. The numbers of these units are called physical addresses or absolute addresses. Therefore, the size of the physical space is determined by the actual capacity of main memory. As shown in Figure 6-1 (c).

3. Address Relocation

examples that require address relocation

As shown in Figure 6-2 (a) is a simple program segment. The first instruction is to take data A to register 1th, the second instruction is to add data B and 1th, the result is placed in 1th registers, the third instruction is to send the contents of the 1th register to the relative address 10. If the program is loaded intact in storage from unit 100th (Figure 6-2 (b)), it will not execute correctly.

Address Relocation

Because a job is loaded into a storage space that is inconsistent with its address space, the adjustment process for the address part is known as the relocation of the address. This adjustment process is the process of transforming the logical address used in the job address space into the physical address in main memory. This address transformation is also known as address mapping.

Figure 6-2 Program Loading examples

4. Reposition Type

According to the time of address transformation and the different technical means, the address relocation can be divided into static reposition and dynamic relocation.

Static Relocation

(1) meaning

Static relocation is done by the assembler before the program is run. In the case of Figure 5-2 (a), just add 100 to the address-related items, as shown in Figure 5-2 (c).

(2) Advantages

Its main advantage is that there is no need to increase the hardware address transformation mechanism, so it can be implemented on a general computer.

(3) Disadvantages

The main disadvantages are:
① requires that each job be allocated a contiguous storage space that cannot be moved during the entire execution of the job, and therefore cannot be reallocated to main memory.
② users must determine the amount of storage required beforehand, and the user must consider the coverage structure if the required amount of memory exceeds the available space.
It is difficult for ③ users to share the same program copy in main memory.

Dynamic Relocation

(1) meaning

Dynamic relocation is implemented by the hardware address transformation mechanism in the process of program execution.

(2) Examples

The easiest way to do this is to use a relocation register. The value of the register is set by the scheduler based on the starting address of the storage space to which the job is assigned. In a computer system with this address transformation mechanism, when the job executes, it does not access main memory according to the logical address given by the CPU, but adds the address of the logical address and the contents of the relocation register as the address of the main memory. Its address transformation process

as shown in Figure 6-3 Reposition Type

Adblock

Figure 6-3 Dynamic Relocation

(3) The main advantages of dynamic relocation are:

① user jobs do not require the allocation of contiguous storage space.
The ② user job can dynamically request storage space and move in main memory during execution.
③ facilitates the sharing of program segments.

(4) The main disadvantages of dynamic relocation are:

① requires additional hardware support.
② the software algorithm to realize storage management is very complicated.

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.