Operating System (eight)-Virtual storage Management

Source: Internet
Author: User

Virtual Storage Management



In the previous summary of the central storage management of the first, require the work of the logical address space for continuous storage of primary storage

In a region. When there is not a large enough area in the primary storage, the job cannot be mounted or must be moved

Some jobs can be loaded. Is it possible that the continuous logical address space of the job is dispersed to several discontinuous main memory

area, and can still make the job execute correctly? If feasible, the main memory space can be used to reduce the mobile

Cost of spending. In addition, virtual storage management technology can be used to run more in the smaller main memory space.

Big homework.


Virtual Storage Management : the implementation of small main memory space to run a larger job.




One, page storage management: The main memory is divided into a large number of areas of the university, each district is called block, the logical partitioning

The size of pages, pages, and blocks.

the logical address of the paging memory consists of two parts:

For example: Address total length 15, where page number 5, page address 10--to derive logical address 32


That is, 2 of the 5 times to 32, where the number is from 0-31; 2 of each page is 10, numbering from 1024.


Note: 1, the logical address is continuous, the program does not need to consider how to paging.


2, sub-main memory block can be discontinuous, can be divided into main memory space by the page.



1, page management conditions:
1) How to know which blocks are used or not used

2) How to perform correctly after dispersing left and right



Allocation Premise : The first free block can meet the left and right requirements.


2, the relevant calculation:

1), block number = font Size * Word length + bit number
2), Cylinder number = block Number/32
3), Magnetic number = block Number First MOD32/4
4), Sector code = block Number First MOD32 in mod 4


3. page table and address translation (dynamic relocation):

In main memory, the idle block can meet the job requirements, storage management will find that these free blocks are assigned to the job, while

Establish a page table for the job, indicating the correspondence between the page number in the logical address and the block number in main memory.


Page Table : The first free block can meet the job requirements at the same time, for the job to build a table, indicating the logical address page number and main memory block number

The corresponding relationship.

Page Table Length: The number of pages that are occupied by the job is determined. For example: four page--a page table length of four registrations.


4. page-type storage Management :
1), dynamic relocation mode loading operation, to the hardware address conversion mechanism, the logical site--the site.
Address = block Number * Block length + in-page address

2), page table put in the main memory, access to two primary memory, one is to read the page table, and second, according to the calculation of the absolute address to read and write. --Extend the instruction execution cycle and reduce execution speed.
3), the introduction of high-speed buffer memory .
Quick Table : the page table called block table stored in the buffer memory.


Block table capacity is small, filling up to new registration, so to eliminate the old: "First out" hair.

For example: main memory 200, buffer memory 40 (run 90%), if there is no buffer memory:

200+200=400

with the buffer memory: (200+40) *90%+ (200+200) *10%=256

4), the entire system only one buffer memory, only the processor can use it.

The fast table is dynamic, the left and right of the processor when the fast table in the buffer memory, otherwise the fast table in the process block.



5, Page table sharing protection : Page table sharing can save memory space, so sharing must also solve the problem of information protection,

--Add "flags" to the page table. such as "Executable only", "only readable", "only can write" the table and so on.




Second, virtual memory


What is virtual storage?

Programs are mutually exclusive, that is, the job is loaded into main memory, the execution of the job does not actually perform these

Information, some of which are not even used throughout the process. So can we not keep our homework at the same time. Personal Master Storage

Instead, the part is loaded into main memory, and the other part is first placed on the disk, which is used when the job executes

When they are not in memory, they are transferred into the main memory.

From this we lead, when the main memory space is smaller than the job requirements, the job can also be executed, the user program is able to

Without regard to the actual capacity of the main memory, the user's logical address space is larger than the absolute address space of the primary memory.

For users, a long time computer system has a large capacity of the main memory, which is called virtual memory.



features :

1, do not put all the work at the same time loaded into main memory, first installed part, the other part of the disk, job execution in the use of not main memory

And then load it into main memory.


2, main memory space is less than the job demand, the operation can also be carried out, the main memory space fully utilized, do not consider the main memory device actual

Size.


3, the virtual memory capacity has the computer's address structure and the auxiliary memory capacity decision.


4, in essence, is to expand the main memory capacity and the use of a management skills.



Allows user logic > primary memory to be the absolute address space.


It seems to the user that there is a large main memory, which is called virtual memory.



Program Mutual Exclusion : The program once run, the implementation of this part of the program, will not go to execute that part of the program.




Three, page-type virtual storage management



1, page Management How to change to virtual storage: The job full information as a copy of the disk.

Supports which pages are already in the main memory device, indicating the location of each page copy on disk. If "1" is installed, there is hardware

"1", such as "0" issued a "page break" (the page is not in the main memory device, check

There is no free block)



2, page scheduling : To transfer into a page is, main memory device no free block is, first call out already in the main memory of a page, in the tune

into the current page, and the method of making corresponding changes to the page table is called page scheduling.



Scheduling Method Classification :
1) FIFO: Eliminate the longest page. (for common disadvantage)
2) Most recently unused least recently Used (LRU) distance is not used in the current maximum time.
(1) Add a "reference bit" flag, must be on every page to record, update, implementation difficulties, overhead.
(2) Page number Queue method: Set the first longest unused page, the tail of the last page, so when the interruption of the team first page paged out, less than the number of FIFO interrupts, good.
3) recently infrequently used: (least recently). )



3, jitter (bumps): Choose an inappropriate scheduling method, just be recalled to be immediately used and be transferred into, transferred into the soon have been adjusted

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





4, Multi-level page table : Program execution is local.
First-level page table:: Level one page Group table, become a Level page table.
Level two page table: in-group page table, bar page table in secondary memory.


Note: A main memory block just put a table.




5, program execution process : When the program executes a page table-to the master address translation, according to the logical address to check a page

Table--According to the "flag" to the Level two page table is in main memory (2 times in the house), if not (visit 4 times)--

Page Number 2 can be looked at the two-level page table, if not, the table should be loaded into main memory first.



Level two page table does not want to put the page table in the main memory device, it is scattered storage, with high-speed buffer memory to speed up the address

Change.



Note: The more pages table level, the greater the flexibility, but the more complex the management.




Summary :

Start by understanding what a page store is, and then learn what virtual storage is, and then combine it with page-based virtual storage

and control their corresponding management mode, scheduling and the corresponding calculation is easy to get started.

This is very useful in our real life, such as your own memory is not large enough, you can set up virtual memory, so that

The computer is handy and convenient to use. Try to make your computer run more efficiently and conveniently.














Operating System (eight)-Virtual storage Management

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.