견적 요청 / BOM 0 로그인 / 등록하다

귀하의 위치를 선택하세요

What is virtual storage and the characteristics of virtual storage?

11월 26, 2020

2657

Virtual storage is a particularly important concept in storage management. You must carefully grasp the definition and characteristics of virtual storage. In addition, you also need to know why virtual storage is introduced, the material basis for the realization of virtual storage technology, and the limitations of virtual storage capacity.


The concept of virtual memory


(1) The benefits of introducing virtual storage


① The user does not need to consider the limitation of memory capacity when compiling the program. As long as the appropriate algorithm and data structure are determined according to the needs of the actual problem, the task of program design can be simplified.


② Since only a part of each process is loaded into the memory, it occupies less memory space, and more processes can be loaded into a certain capacity of memory at the same time, which also increases the utilization rate of the CPU and the throughput of the system accordingly.


In order to provide convenience to users (especially users of large operations), the operating system should manage all levels of storage in a unified manner. That is to say, the part of a program currently being used should be placed in memory, and the rest should be placed on the disk, in this case the process is started. The operating system uses swapping technology to randomly swap in/out each program according to the requirements during program execution and the actual memory usage.


(2) Swap technology


Swap technology is also called exchange technology. Its implementation is similar to how several units rent a conference hall in daily life. Unit A will exit the conference hall when the rental time is up and be used by Unit B; when unit B arrives, it will also withdraw and be used by Unit C. and many more. If unit A still needs to be used, it will be rented again, and the time will be arranged by the manager.

virtual storage.png

Swap technology is also used in a multi-program environment. At this time, multiple processes remain in the memory. When the memory space is not enough to accommodate the process that requires access to the memory, the system swaps out the temporarily inoperable processes (including programs and data) in the memory to the external memory, freeing up memory space, and removing the processes that are capable of running from the external memory. Change to memory. In the UNIX/Linux system, the management of memory utilizes this multi-program swap technology.


(3) The concept of virtual memory


Virtual Memory is a virtual storage space that users can treat as addressable memory. It separates user logical storage from physical storage, and is an address space that the operating system provides to users, which is much larger than real memory space. That is to say, virtual memory is not actual memory, its size is much larger than memory space; users feel that the "memory" that can be used is very large, which is an expansion of logical memory by the operating system.


The material basis for realizing virtual storage technology is the secondary memory structure and dynamic address translation mechanism. After the transformation of the operating system, the memory and external storage are organically linked together, presenting a large memory space sufficient for programming needs in front of users.


Virtual memory essentially distinguishes the user address space from the actual storage space as two different concepts. The dynamic address conversion mechanism converts the logical address into a physical address when the program is running to achieve dynamic positioning.


It should be noted that although the virtual memory provides users with a very large address space, users generally do not need to consider how large the available space is when programming, but the capacity of the virtual memory is not infinite. It is mainly restricted by two aspects:


①The word length of the address in the instruction. The number of binary digits representing the address in the machine instruction is limited. If the address unit is addressed in bytes and the word length representing the address is 16 bits, the maximum address space that can be represented is 64KB. If the word length representing the address is 32 bits, the maximum address space that can be represented is 4GB.


②The capacity of external storage. From an implementation point of view, the user's programs and data must be completely stored in external storage (such as hard disk). However, external memory capacity, transmission speed and frequency of use are all limited by physical factors. That is to say, the capacity of the disk is limited, not really "infinite", and its transfer speed is not "infinitely fast", so the virtual space cannot be infinite.


Characteristics of virtual storage


The characteristics of virtual memory can be summarized in 16 words: virtual expansion, partial loading, discrete allocation, multiple swaps.


The basic concept of virtual storage should be understood from the following four aspects, which are also the basic characteristics of virtual storage:


①Virtual expansion


The virtual memory is not to expand the physical memory space, but to expand the logical memory capacity. In other words, the address space used by the user during programming can be much larger than the actual memory capacity. For example, the actual memory is only 1MB, but the space used by user programs and data can reach 10MB or more. Therefore, the user "feels" the memory expansion.


②Partially installed


Each process is not loaded into memory all at once, but divided into several parts. When the process is to be executed, only the part of the program and data needed for the current operation needs to be loaded into the memory. Later, when other parts are used in the running process, those parts are transferred from external storage to memory respectively.


③Discrete distribution


A process is divided into multiple parts, they are not all loaded into memory. Even the part that is loaded into the memory does not need to occupy contiguous memory space. In this way, the memory part of a process may be scattered in different places in the memory, not continuous with each other. Doing so can not only avoid the waste of memory space, but also provide convenience for the process to dynamically load the memory.


④Swap multiple times


During the running of a process, all the programs and data required by it are divided into memory for multiple times. Each time a part is transferred, only the current needs are solved, and the programs and data in the memory that are not used temporarily can be swapped out to the swap area of the external memory; even the entire image of the temporarily inoperable process in the memory is changed Go out to the swap area to free up as much memory space as possible for runnable processes. The recalled programs and data can be recalled to the memory when needed.


The virtual memory can be divided into two types of paging virtual memory and segmented virtual memory according to the structure of the address space. This course only introduces paged virtual memory.