The role of Linux virtual memory

To learn more about linux memory operation mechanism, it is necessary to know the below mentioned aspects:
First, Linux system from time to time for page exchange operations, in order to keep as much free physical memory, and even if nothing needs memory, Linux also It would not have temporarily swapped out of memory pages. This avoids waiting time required for the exchange.

Secondly , linux for page exchange is conditional, not all pages when not in use are switched to virtual memory, linux kernel based on "most often recently used" algorithm, simply swap some pages are not frequently used files into virtual memory, sometimes we You see such a phenomenon: linux there are a lot of physical memory, but also use a lot of swap space. In fact, it is not surprising, for example, take up a lot of memory process is running, it takes a lot of memory resources, then there will be some of the less frequently used files are swapped pages into virtual memory, but later this take up a lot of memory resources At the end of the process and releases a lot of memory, it has been swapped out page files are not automatically exchanged into physical memory, unless this is necessary, then the system is at the moment a lot of physical memory will be idle, and swap space are being used, there have been just mentioned phenomenon. On this point, do not worry about anything, as long as know how it is on it.

Finally , the page swap space when in use will first be exchanged into physical memory, if at this time there is not enough physical memory to accommodate these pages, they will be immediately swapped out, so since there may not be enough virtual memory space to store these swap pages, will eventually lead to false crash linux, service exceptions and other issues, although linux can restore itself over time, but the system after the recovery has been basically unusable.
Therefore, rational planning and design linux memory usage is very important.

Guess you like

Origin www.cnblogs.com/insane-Mr-Li/p/11209474.html
Recommended