Home > Common Problem > body text

What is the use of virtual memory?

清浅
Release: 2020-10-12 16:52:42
Original
80156 people have browsed it

Virtual memory uses external storage as memory, that is, using a hard disk to simulate memory usage, which can alleviate the pressure of insufficient physical memory and help improve resource utilization. Virtual memory can easily save those occupied RAM blocks that are barely used; the freed RAM can then be used to accommodate more programs with higher priority, improving the overall performance of the system.

What is the use of virtual memory?

Virtual Memory

Virtual memory is a technology for computer system memory management. It makes the application think that it has contiguous available memory (a contiguous complete address space), but in fact, it is usually divided into multiple physical memory fragments, and some are temporarily stored on external disk storage when needed. data exchange. Currently, most operating systems use virtual memory, such as the "virtual memory" of the Windows family; the "swap space" of Linux, etc.

Virtual memory refers to the software or programs we use when using computers. One of the characteristics of virtual memory is its low price and large capacity. However, the running speed of virtual memory and the running speed of CPU registers are slower. Usually, CPU registers are generally calculated in MB or KB, and the size of virtual memory is generally All are in GB. Another characteristic of virtual memory is that after a sudden power outage, the data in the virtual memory will be lost. We don't want our usual hard disk to have a save function after a power outage.

The role of virtual memory

Virtual memory, just like its name, does not use the memory area as memory. Simply put, it treats external storage as memory. to use. But this has a big disadvantage, that is, the running speed of external memory is slower than the running speed of memory, which will cause virtual memory to indirectly affect the running speed of memory.

Simply put, virtual memory uses a hard disk to simulate memory usage. Objectively speaking, if your memory is large enough, you don't need virtual memory. But in fact, this is often impossible. In order to make better and more effective use of memory resources, the operating system usually loads the most commonly used modules into the cache, then puts the commonly used modules into the memory, and puts the least commonly used modules that need to be called during operation into the hard disk.

In this way, resource utilization can be effectively improved. Virtual memory is a logical concept composed of the parts placed on the hard disk. In WINDOWS, it is implemented using a swap file. In LINUX systems, it is a fixed partition. For WINDOWS systems, the existence of this file is equivalent to increasing the memory capacity. However, this part of the capacity is very slow to use (because the hard disk is a mechanical device). Logically, this part of the hard disk space acts as memory, so it is called virtual memory.

Benefits of using virtual memory

It can easily save those RAM blocks that are rarely used but are occupied. The freed RAM can then be used to accommodate more programs with higher priority.

Prevent the situation where RAM space runs out and other programs cannot be executed.

Virtual memory acts as a backup of RAM, thereby increasing the actual space of RAM.

During hibernation, all contents of RAM are written to swap space. Therefore, virtual memory is required for successful hibernation.

It improves the overall performance of the system. (When the kernel parameter swappiness is set appropriately)

The above is the detailed content of What is the use of virtual memory?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template