Operating System (8)-virtual storage management

Source: Internet
Author: User

Operating System (8)-virtual storage management

Virtual Storage Management

In the previous section, we summarized the requirements for centralized storage management. The logical address space of a job is required to store the primary storage in a certain region consecutively. If the primary storage does not have a large enough area, the job cannot be loaded, or you must move some jobs before loading. Is it possible that the continuous logical address space of a job is distributed to several discontinuous primary storage areas, and the job can still be correctly executed? If feasible, you can make full use of the primary storage space to reduce the overhead of mobile. In addition, virtual storage management technology can be used to run large jobs in a small primary storage space.


Virtual Storage Management: A large number of jobs run in a small primary storage space.



I. Page-based storage management:Divide the primary memory into many areas of the University. Each area is called a block and the logical partition is compiled.

Page, page, and block.

The Logical Address of paging memory consists of two parts:

For example, the total address length is 15, where page number 5 and page address 10 -- the logical address 32 is obtained.

It is 32 for the 5 times of 2, where the number ranges from 0 to 31; the 10 times of 2 on each page are 1024, And the number ranges from 0 to 1023.


Note: 1. The logical address is continuous, so you do not need to consider paging during programming.

2. The primary storage blocks can be left and right disconsecutive, and can be dispersed in the primary storage space by page.



1. Page management conditions:
1) how to know which blocks are used or unused

2) Correct execution after the Left and Right Dispersion


Allocation prerequisites: First, whether the idle block can meet the left and right requirements.


2. Related computing:
1), block number = font size * font Length + bit number
2), cylinder number = block number/32
3) Head number = block number first Mod32/4
4), Fan area number = block number first Mod32 in Mod 4


3, Page table and address conversion(Dynamic Relocation ):

When the idle block in the primary storage can meet the job requirements, the storage management finds out that the idle blocks are allocated to the job, and creates a page table for the job, specifies the correspondence between the page number in the logical address and the block number in the primary address.


Page table: First, the idle block can meet the job requirements. At the same time, create a table for the job and point out the correspondence between the address page number and the block number in the primary storage.

Page table length:The number of pages that a job occupies depends on. For example, four pages -- four register items with the length of A page.


4, Page Storage Management:
1) dynamically relocate a job. hardware address translation mechanism is required, and the Master Address is the absolute address.
Address = block number * block Length + page address

2) The page table is stored in the primary storage and accessed twice. One is to read the page table, and the other is to read and write the table based on the calculated outbound address. -- Extend the instruction execution cycle and reduce the execution speed.
3 ), Introduction of High-Speed Buffer Memory.
Fast table: The page table stored in the cache is called a block table.

The block table capacity is small, and new registration is required after it is filled up, so the old one should be eliminated: "first-in-first-out.

For example, if the primary memory is 200 and the high-speed buffer memory is 40 (running 90%), if there is no high-speed buffer memory:

200 + 200 = 400

With high-speed buffer memory: (200 + 40) * 90% + (200 + 200) * 10% = 256

4) the entire system has only one high-speed buffer memory, which can be used only by the processor.

The speed table is dynamic. When the left and right sides occupy the processor, the speed table is in the high-speed buffer memory; otherwise, the speed table is in the Process block.

5. page table sharing Protection: Page table sharing can save the primary storage space, so sharing must solve the information protection problem. -- add a "sign" to the page table ". For example, "only executable", "only readable", and "only writable" tables.

Ii. Virtual Memory


What is virtual memory?

Some tasks of the program are mutually exclusive, that is, the job is loaded into the primary storage, and the execution of the job is not actually executed at the same time, and some are not even used throughout the process. Therefore, we can mount some of the jobs into the primary memory and the other into the disk without having to keep them in personal primary memory at the same time, when a job is executed with information that is not in the memory, it is transferred to the primary memory.

From this, when the primary storage space is smaller than the job requirements, the job can also be executed, User Programming does not have to consider the actual capacity of the primary storage, the logical address space of a user can be larger than the absolute address space of the primary storage. For a user, the computer system has a large primary memory for a long time, which is called virtual memory.



Features:

1. Do not load all jobs into the primary storage at the same time. First, install a part and another part on the disk. During job execution, use a part that is not in the primary storage and then load it into the primary storage.

2. The primary storage space is smaller than the job demand, and the job can be executed. The primary storage space is fully utilized without considering the actual size of the primary storage.

3. The capacity of the virtual memory is determined by the address structure of the computer and the capacity of the secondary storage.

4. In essence, it is a management technique used to expand the primary storage capacity.


Allow user logic> primary storage to reject the address space.

For users, there seems to be a large primary storage, which is calledVirtual Memory.


Programs are mutually exclusive: When this part of the program is executed in one run, it will not be executed.

3. webpage-based virtual storage management


1, How to change page management to virtual memory:The full information will be used as copies to store the disk.

Which pages are supported in the primary storage, indicating the locations of each page copy on the disk. If "1" is installed, the hardware address translation organization page table is "1" to reject the address, such as "0" to issue "page missing interruption" (This page is not in the main memory, check whether there are idle blocks)

2. Page Scheduling: If you want to call a page, the primary memory does not have any idle block. First, call a page already in the primary memory, call the current page, and modify the page table to schedule the page.


Scheduling Classification:
1) first-in-first-out/FIFO: the page that takes the longest time out. (Unfavorable for common use)
2) The latest unused Least Recently Used (LRU) call-up that has not been Used in the longest time.
(1) Add a "reference bit" sign, which must be recorded and updated on every page at all times; implementation is difficult and overhead is high.
(2) page number queue law: it specifies that the first unused page and the last page at the end of the team should be called out on the homepage when the queue is interrupted, which is better than the FIFO.
3) Not commonly used recently: (the least recently used .)


3. jitter (bumps): The scheduling method is not suitable. After being called up, it needs to be immediately used and transferred. Soon after being transferred, it will be called.

Out, frequent scheduling, so that most of the time on the back and forth scheduling phenomenon is called jitter.


4. Multi-level page table: The program is locally executed.
Level 1 page table: the level 1 page group table.
Level 2 page table: Intra-group page table, which is stored in secondary storage.


Note: a primary storage block is placed in a table.

5. Program Execution Process: When the program is executed, the first-level page table -- converts the address to the master node, and queries the first-level page table based on the Logical Address -- checks whether the second-level page table is stored in the master node (twice in the House ), if not (access four times)-You can query the second-level page table by page number 2. If no table item exists, load it to the primary storage first.

The second-level page table does not want to load the page table into the primary memory at a time. It is stored discretely and uses high-speed buffer memory to speed up address conversion.

Note: The more page tables, the more flexibility, but the more complicated the management.

Summary:

First, understand what is page-based storage, what is virtual storage, and then combine the page-based virtual storage to master their corresponding management methods, scheduling Methods and corresponding computing are easy to use. This is of great use in our real life. For example, if our memory is not large enough, we can create virtual memory to make computers easy to use. Try it to make your computer more efficient and convenient.

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.