[Operating system] Chapter V Operation System: Virtual Memory

5.1 virtual memory causes
(1) Contents
- Causes
- cover art (early) / switching technology (early) virtual memory technology /
- Virtual Memory Technology: objective / program locality principle / basic concepts / basic features / paged virtual memory management
(2) cause
- often not enough memory. Program size is greater than the increase in the growth of memory capacity.
- Ideal memory: bigger, faster, cheaper, non-volatile memory.

- The hard disk space to spend (to play the role of memory)

- not commonly used on the hard disk, commonly used on memory.
(3) in a computer system, especially in the multi-channel environment is running, it may be the case of the emergence of memory is not enough, how do?
-> If the program is too large, exceeding the memory capacity can be manually cover (overlay) technology uses, only the required data and instructions stored in memory
-> If the program is too much, exceeding the memory capacity, may be employed automatic exchange (swapping, or in) technology, the program can not be executed to temporarily external memory
-> to a limited memory capacity, a smaller particle size of the page unit is loaded more larger program, can be used to automatically virtual storage technology.

5.2 overlay technique
(1) the target
run large programs available memory smaller. Commonly used in multiprogramming system, used in conjunction with the storage management.
(2) the principle of
the procedure according to its own logical structure, divided into several functionally independent program modules, that module will not be executed simultaneously with a shared memory region, has time to run.
-> necessary permanent memory portion (common function) code and data
-> optional parts (function not used) implemented in other program modules, usually stored in the external memory, loaded into memory when needed.
-> module does not exist at the same time do not have to call relationship into memory, so as to cover each other, i.e. modules share a partition.

(3) disadvantages
- a programmer to program into a large number of small modules, and to determine the coverage relationship between the various modules, time consuming, increases the complexity of programming.
- covering the module into memory from the external memory, it is a time for space.

5.3 switching technology
(1) target
multi-channel program in the memory, so that the running program or programs need to run to get more memory resources.
(2) Method
- temporarily can not run the program to the external memory to obtain a free memory space.
- the operating system to save the contents of the entire address space of a process to external memory (swap out swap out), and the external memory in the address space of a process is read into memory (swap in swap in). SUMMARY swapped out to the address space size of the entire program.

(3) switching technology to achieve several problems in
- to determine the timing of the exchange: Only when there is not enough memory space is not enough or when changing out of danger
- the size of the swap area: must be large enough to hold all user processes all memory image copies , must be able to directly access these memory-mapped
- change-fitting program relocation: because of the change of the position change into a memory not necessarily the same, so the best dynamic address mapping method
(4) covers a switching technology comparison
- covering only occur between those program modules (the program) does not call relationship to each other, so the programmer must be given logical overlay structure between the various modules within the program.
- switching technology is based on the size of the program in the memory unit after it does not require the programmer to cover the logical structure analysis between various modules.
-> exchange takes place between the memory and the management program or operating system, and run the program to cover internal color will tell you in the hair.

5.4 virtual (proposed) (internal) memory (Management) technology
target virtual memory technology (1)
- Japanese exchange technology to solve covered major technical problems to the programmer processor overhead burden.
- like covering technologies, not all the contents of the program are placed in memory, it is possible to run larger than the current free memory space program. But to do better, to complete by the operating system automatically, without programmer intervention
- can be like switching technology that can realize the exchange processes between memory and external memory, and thus gain more free memory space. But we can do better, for part of the process of exchange between the internal memory and the external memory only.

Locality principle (2) procedure (principle of locality)
refers during execution of the program for a short time, the instruction operand address and the address of the executed instructions are limited to certain areas, as follows:
-> Temporal locality : one execution and the next execution, a data access time and the next time you visit are concentrated in a short period of time an instruction
-> spatial locality: the current instruction and close collar few instructions, access to current data and collar near several data are concentrated in a small area within the
locality principle program it suggests, in theory, virtual storage technology can be achieved, but also in the realization of the future should be able to achieve a satisfactory effect.

Note that, a method of accessing a row, that is, each access a skipped 1024, taking into account only put 1024 4k digital (int representing a 32-bit, four byte), so that each visit are swapped out, does not meet the spatial locality.

References
https://www.bilibili.com/video/av6538245?p=19

Published 29 original articles · won praise 19 · views 4439

Guess you like

Origin blog.csdn.net/iwanderu/article/details/103946338